问题
I installed the latest version of Intel C++ Compiler v12.1.2 on Arch Linux 3.2.1. When I used icpc to compile my C++ file
icpc -O3 -DNDEBUG -std=gnu++0x -o obj/main.o src/main.cpp -c
or
icpc -O3 -DNDEBUG -std=c++0x -o obj/main.o src/main.cpp -c
A warning popped out
Warning #2928: the __GXX_EXPERIMENTAL_CXX0X__ macro is disabled when using GNU version 4.6 with the c++0x option
My main.cpp contains many C++0x features such as rvalue references, auto, etc. But the Intel compiler did not work in C++0x mode. How to turn on its C++0x features?
回答1:
I had to fight my way through this, but a quick solution seems to be:
- Install libstdc++4.5 (or earlier)
- compile with
icpc -gcc-name=gcc-4.5 -std=c++0x
The problem is that Intel compilers do not support all the C++0x features that GNU compilers do starting from version 4.6. This causes incompatibilities with GNU libstdc++ headers since at present all the C++0x features are protected by a unique macro __GXX_EXPERIMENTAL_CXX0X__
and cannot be enabled or disabled singularly.
回答2:
Check here. It seems that C++0x is not fully supported
来源:https://stackoverflow.com/questions/8938325/how-to-turn-on-c0x-of-intel-c-compiler-12-1-2