首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

stl使用报错,该如何解决

2012-03-08 
stl使用报错错误: 跳过 ‘__gnu_cxx::__normal_iteratorconst RECVOBJ*, std::vectorRECVOBJ, std::alloc

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).

----------------
请楼主无论如何以后问问题把问题说清楚,把报错信息说清楚。

热点排行