How to turn on C++0x of Intel C++ Compiler 12.1.2

无人久伴 提交于 2019-12-18 08:56:17

问题


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:

  1. Install libstdc++4.5 (or earlier)
  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!