今天在vc6.0中使用了map,在map中嵌套了vector,错误报错了error C2143: syntax error : missing '>' before ';'错误,但是同样的代码,在vs2005中却不会报错,浪费了我很长时间,解决方案如下,希望对其他遇到同样的朋友有所帮助
编译环境VC6.0
程序如下:
#include<vector>
#include<map>
#include<iostream>
int main()
{
std::map<int,std::vector<int>>;
return 0;
}
提示下面错误:
--------------------Configuration: test - Win32 Debug--------------------
Compiling...
main.cpp
D:\Program Files\Microsoft Visual Studio\MyProjects\test\main.cpp(7) : error C2143: syntax error : missing '>' before ';'
Error executing cl.exe.
main.obj - 1 error(s), 0 warning(s)
错误解决:
将 std::map<int,std::vector<int>>; 修改为std::map<int,std::vector<int> >;
注意:vector<int>后面加了一个空格
在vs2005中不会报错,可能是由于vc6.0和vs2005的编译器不一样的缘故吧。
分享到:
相关推荐
8. Error C2143:syntax error: missing ':' before '{' 这是一个常见的编译错误,原因是句法错误:“{”前缺少“;”。解决方法是检查代码中的句法是否正确。 9. Error C2146:syntax error : missing ';' before...
4. **403 Syntax Error in Transaction**:交易中的语法错误,通常是由于消息结构不符合预期导致的。 5. **406 Version Not Supported**:表示客户端使用的版本不受支持。 6. **410 Incorrect Identifier**:标识符...
- CR# 533796 - Corrected syntax for NGDBuild command. - Virtex-6 clock modules not using production MMCM settings - Version fixed : v5.4rev1 - CR#546021 - Using outdated values from the clocking ...
[3001637] CMOS MAP register meaning error [2994370] Cannot build with 3DNow support - these S.F. feature requests were closed/implemented [1510142] Native Windows XP x64 Edition binary [1062553] ...
* log file now contains "<WARNING>" and "<ERROR>" indicators * workaround for movie playlists which want the same m2ts file played twice * added version check for eac3to (doh!) * when a read error ...
The format of the symbol name should be <PROJECT>_<PATH>_<FILE>_H_. To guarantee uniqueness, they should be based on the full path in a project's source tree. For example, the file foo/src/bar/baz.h...