我们已经在一台 Scientific Linux 机器上手动安装了 GCC 6.2.0。C++ 应用程序的编译似乎很好,但我们undefined references
在链接时得到了很多 CXX11
file.cpp:(.text+0x16cb): undefined reference to `std::__cxx11::list<void*, std::allocator<void*> >::list(std::__cxx11::list<void*, std::allocator<void*> > const&)'
我们知道双重 ABI 问题,但编译-D_GLIBCXX_USE_CXX11_ABI=0
没有任何区别。我们还有哪些其他选择?
更新
CMAKE配置如下:
-- The C compiler identification is GNU 6.2.0
-- The CXX compiler identification is GNU 6.2.0
-- Check for working C compiler: /opt/GNU/gcc-6.2.0/bin/gcc
-- Check for working C compiler: /opt/GNU/gcc-6.2.0/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /opt/GNU/gcc-6.2.0/bin/g++
-- Check for working CXX compiler: /opt/GNU/gcc-6.2.0/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
这是编译行file.cpp
gcc-6.2.0/bin/g++ -O3 -fopenmp -DNO_HDF5 -D_GLIBCXX_USE_CXX11_ABI=0 -I./include -I/opt/mpich/3.2/include -o file.cpp.o -c file.cpp
和链接(实际上失败的地方)
gcc-6.2.0/bin/g++ -O3 -fopenmp -DNO_HDF5 -D_GLIBCXX_USE_CXX11_ABI=0 main.cpp.o -o ASTEP -rdynamic libMainASTEPlib.a -lhdf5_hl -lhdf5 -lz -lm -lhdf5_hl -lhdf5 -lz -lm /opt/mpich/3.2/lib/libmpicxx.so /opt/mpich/3.2/lib/libmpi.so -Wl,-rpath,/opt/mpich/3.2/lib
此外,MPICH 3.2 已使用新编译器 (gcc 6.2.0) 构建