问题描述
我尝试使用 emplace()
函数作为unordered_map,编译器说没有这样的函数存在。
I try to use emplace()
function for an unordered_map and compiler says that no such function exists.
我把 -std = c + 11
,它说: cc1plus.exe:错误:unrecognized命令行选项'-std = c + 11' / code>
I put -std=c+11
and it says cc1plus.exe: error: unrecognized command line option '-std=c+11'
我可以用mingw来使用C ++ 11的功能吗?
Can i somehow use C++11 functionality with mingw?
推荐答案
C ++ 11特性作为mainlineGCC编译器的一部分提供给
GCC的Subversion版本库和GCC 4.3及更高版本的中继。要
启用C ++ 0x支持,请将命令行参数 -std = c ++ 0x 添加到
您的g ++命令行。或者,要启用除
C ++ 0x扩展之外的GNU扩展,请将-std = gnu ++ 0x添加到您的g ++命令行。 GCC 4.7
及更高版本支持 -std = c ++ 11 和-std = gnu ++ 11。
C++11 features are available as part of the "mainline" GCC compiler in the trunk of GCC's Subversion repository and in GCC 4.3 and later. To enable C++0x support, add the command-line parameter -std=c++0x to your g++ command line. Or, to enable GNU extensions in addition to C++0x extensions, add -std=gnu++0x to your g++ command line. GCC 4.7 and later support -std=c++11 and -std=gnu++11 as well.
所以,对于gcc 4.3到4.6使用-std = c ++ 0x,对于以后的版本使用-std = c ++ 11。对 map :: emplace
的库支持已添加到gcc 4.8
So, for gcc 4.3 through 4.6 use -std=c++0x, for later version use -std=c++11. Library support for map::emplace
was added in gcc 4.8
这篇关于MinGW的C ++ 11功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!