包含<map>会导致g ++ 4.6.2 </map>的编译错误

时间:2013-05-04 15:28:01

标签: c++ map g++ mingw

我收到一个奇怪的编译错误,我无法解释。以下代码是一个最小的例子,给我这个错误:

#include <map>
int main()
{
    return 0;
}

问题是,由于包含map-header文件,我收到错误:

p:\mingw\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/stl_map.h:109:15: error: 'map' is not a template
p:\mingw\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/stl_map.h:162:48: error: only declarations of constructors can be 'explicit'
p:\mingw\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/stl_map.h:172:17: error: 'map' does not name a type
p:\mingw\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/stl_map.h:252:7: error: 'map' does not name a type
p:\mingw\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/stl_map.h:693:12: error: 'map' is not a type
p:\mingw\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/stl_map.h:856:26: error: 'map<_K1, _T1, _C1, _A1>' does not name a type
p:\mingw\bin\../lib/gcc/mingw32/4.6.2/include/c++/bits/stl_map.h:857:12: error: 'map<_K1, _T1, _C1, _A1>' does not name a type
...

这种情况一直持续下去(100次此类错误)。包含其他c ++标题(如字符串,向量等)没有问题。

我尝试通过谷歌找到一些相关信息,但没有成功。有谁知道这样的问题可能是什么原因?

如果有帮助:我正在使用Windows 7,并运行'g ++ -v'输出:

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=p:/mingw/bin/../libexec/gcc/mingw32/4.6.2/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.6.2/configure --enable-languages=c,c++,ada,fortran,objc,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgomp --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs --build=mingw32 --prefix=/mingw
Thread model: win32
gcc version: 4.6.2 (GCC)

0 个答案:

没有答案