使用 gcc4.7 标准库与英特尔 12.1.3 一起编译
Compile with Intel 12.1.3 using gcc4.7 std library
我遇到了这篇文章中描述的相同问题,只是我使用的是英特尔版本 12.1.3。(g++
的标头<functional>
受 #ifdef __GXX_EXPERIMENTAL_CXX0X__
保护,而使用 ICPC 时未定义该
与其使用 boost::functional
,我想安装 gcc4.7 并使用它的 std 库。
在 Ubuntu 11.10 中,我有gcc4.6.1
,但我也从gcc-snapshot
包中安装了gcc4.7
。
英特尔有 -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。有谁知道如何让英特尔使用正确的库?
我发现,如果你使用 gcc(或 g++)和标志 -v -Q 编译,你会得到一个标志列表并定义。 它可能会帮助您了解 gcc 的作用,因此您可以在 icpc 中使用相同的 -D/-U。 此外,g++ -E 将在不编译的情况下进行预处理:您可以从中获得有用的路径信息。
- 要与"if constexpr"一起使用的编译时消息(在预处理器之后)
- 使用个人C++库编译代码时,与头文件一起使用时会中断
- 将 std::variant 与 gmock 1.8 对象一起使用时编译错误
- 为什么引用不能与编译时函数一起使用?
- 如何将编译的 wxwidgets 与 cmake 一起使用
- 与类一起使用时 std::reference_wrapper "has no member named" 编译错误
- 与C 一起编译和链接卷曲简易接口
- C++:当与 std::cout 一起使用时,constexpr 函数在编译时不会计算
- 将PCH,PDB和Zi组合在一起会导致VS2017的C2859编译错误令人费解
- 可以将力包括在视觉C 中与预编译的标头一起使用
- 与教堂的"compileline"一起编译C++
- 在代码块中一起编译两个项目
- 在Java(JNI)中与Mingw C 一起编译64位静态LIB
- 使用QMake将Ubuntu中的QT和OPENCV一起编译
- 与Cygwin一起编译一个C++项目
- 在C++中一起编译源文件和头文件时出错
- 使用 gcc4.7 标准库与英特尔 12.1.3 一起编译
- 编写一个makefile,将.h .hpp和.cpp一起编译为可执行文件
- 将使用C++98标准编写的代码与新的编译器一起编译
- 如何将fltk文件与其他文件一起编译