问题
After reading a lot of literature on the internet, it seems that recent GCC versions definitely support the -std=c++11
command line option. But for some crazy reason, I get the "unrecognized command line option" even when using GCC 4.8.1 which doesn't make any sense.
C:\newmingw\mingw32\bin>g++ -v
Using built-in specs.
COLLECT_GCC=g++
Target: i686-w64-mingw32
Configured with: [trimmed]
Thread model: win32
gcc version 4.8.1 (rev5, Built by MinGW-W64 project)
C:\newmingw\mingw32\bin>g++ -std=c++11 test.cpp
cc1plus: error: unrecognized command line option "-std=c++11"
Is there anything else that needs to be done here? TIA!
回答1:
I am using mingw obtained via mingw-get from http://www.mingw.org/wiki/Getting_Started
I can not confirm your problem. It might have something to do with your version being x64?
My version output is nearly identical:
C:\>g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.8.1/lto-wrapper.exe
Target: mingw32
Configured with: [...]
Thread model: win32
gcc version 4.8.1 (GCC)
I am currently using this for a large project that uses a lot of the new c++11 functionalities.
来源:https://stackoverflow.com/questions/22120267/unrecognized-command-line-option-std-c11-for-gcc-4-8-1