stl使用报错,该如何解决
stl使用报错
错误: 跳过 ‘__gnu_cxx::__normal_iterator<const RECVOBJ*, std::vector<RECVOBJ, std::allocator<RECVOBJ> > > sit’ 的初始化
请问高手,什么原因引起该问题啊,是编译器的原因还是什么的?
先谢谢大家了!
在线等结果!
------解决方案--------------------
大哥,这个错误明显是goto引起的。
你在哪里有一个goto mailend
然后gcc说,因为这个goto mailend,所以从这里,跳过了map的初始化,这是错误的。
------解决方案--------------------
作为一个c++标准控,我用c++标准回答你,
c++标准说,goto不可以跳过constructor.
例如,
goto next; //错误,goto不可以跳过int a
int a;
next: a++;
原文:
A program that jumps from a point where a variable with automatic storage duration is not in scope to a point where it is in scope is ill-formed unless the variable has scalar type, class type with a trivial default constructor and a trivial destructor, a cv-qualified version of one of these types, or an array of one of the preceding types and is declared without an initializer (8.5).
----------------
请楼主无论如何以后问问题把问题说清楚,把报错信息说清楚。
错误: 跳过 ‘__gnu_cxx::__normal_iterator<const RECVOBJ*, std::vector<RECVOBJ, std::allocator<RECVOBJ> > > sit’ 的初始化
请问高手,什么原因引起该问题啊,是编译器的原因还是什么的?
先谢谢大家了!
在线等结果!
------解决方案--------------------
大哥,这个错误明显是goto引起的。
你在哪里有一个goto mailend
然后gcc说,因为这个goto mailend,所以从这里,跳过了map的初始化,这是错误的。
------解决方案--------------------
作为一个c++标准控,我用c++标准回答你,
c++标准说,goto不可以跳过constructor.
例如,
goto next; //错误,goto不可以跳过int a
int a;
next: a++;
原文:
A program that jumps from a point where a variable with automatic storage duration is not in scope to a point where it is in scope is ill-formed unless the variable has scalar type, class type with a trivial default constructor and a trivial destructor, a cv-qualified version of one of these types, or an array of one of the preceding types and is declared without an initializer (8.5).
----------------
请楼主无论如何以后问问题把问题说清楚,把报错信息说清楚。