`
isiqi
  • 浏览: 16814853 次
  • 性别: Icon_minigender_1
  • 来自: 济南
社区版块
存档分类
最新评论

使用map时提示error C2143: syntax error : missing '>' before ';'

阅读更多

今天在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的编译器不一样的缘故吧。

分享到:
评论

相关推荐

    最常见的VC++编译错误信息_fatal_error

    8. Error C2143:syntax error: missing ':' before '{' 这是一个常见的编译错误,原因是句法错误:“{”前缺少“;”。解决方法是检查代码中的句法是否正确。 9. Error C2146:syntax error : missing ';' before...

    H248-协议错误码

    4. **403 Syntax Error in Transaction**:交易中的语法错误,通常是由于消息结构不符合预期导致的。 5. **406 Version Not Supported**:表示客户端使用的版本不受支持。 6. **410 Incorrect Identifier**:标识符...

    k7 SRIO参考例程

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

    Bochs - The cross platform IA-32 (x86) emulator

    [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] ...

    eac3to V3.17

    * log file now contains "&lt;WARNING&gt;" and "&lt;ERROR&gt;" indicators * workaround for movie playlists which want the same m2ts file played twice * added version check for eac3to (doh!) * when a read error ...

    Google C++ Style Guide(Google C++编程规范)高清PDF

    The format of the symbol name should be &lt;PROJECT&gt;_&lt;PATH&gt;_&lt;FILE&gt;_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...

Global site tag (gtag.js) - Google Analytics