我遇到this帖子中描述的相同问题,但我使用的是英特尔12.1.3版本。 (g++
的标头<functional>
受#ifdef __GXX_EXPERIMENTAL_CXX0X__
保护,使用icpc时未定义{。}
我没有使用boost::functional
,而是想安装gcc4.7并使用它的std库。
在Ubuntu 11.10中我有gcc4.6.1
但我还从gcc4.7
包中安装了gcc-snapshot
。
英特尔拥有选项-gcc-name
,-gxx-name
和-cxxlib
。
所以我最初用以下代码编译:
-std=c++0x -gcc-name=/usr/lib/gcc-snapshot/bin/gcc -gxx-name=/usr/lib/gcc-snapshot/bin/g++ -cxxlib=/usr/lib/gcc-snapshot/
但是我收到了错误:
icpc: error #10282: file
'/usr/lib/gcc-snapshot/bin/usr/lib/gcc-snapshot/bin/g++' not found,
generated based on '-cxxlib=/usr/lib/gcc-snapshot/'
然后我编译:
-std=c++0x -gcc-name=./gcc -gxx-name=./g++ -cxxlib=/usr/lib/gcc-snapshot/
。
但我仍然收到警告和错误:
Warning #2928: the __GXX_EXPERIMENTAL_CXX0X__ macro is disabled when using GNU version 4.6 with the c++0x option
error: namespace "std" has no member "function"
该警告明确表示它仍在使用4.6版本。有谁知道如何让英特尔使用正确的库?
答案 0 :(得分:0)
我发现如果你使用带有flags -v -Q的gcc(或g ++)进行编译,你会得到一个标志和定义列表。它可能会帮助你看到gcc的功能,也许你可以在icpc中使用相同的-D / -U。 g ++ -E也会在不编译的情况下进行预处理:你可以从中获得有用的路径信息。