g++;无法与libboost\u date\u time链接

g++;无法与libboost\u date\u time链接,boost,linker,g++,Boost,Linker,G++,所以我怀疑这是因为我最近在我的系统(ubuntu 14.04)上制作并安装了gcc-7.3.0。这曾经奏效,但现在不行了,我真的不明白为什么。 欢迎提出任何建议 谢谢: 丹 g++-7.3.0不编译 dan@chicabuntu:~/RNN/GAForest$ g++ -o validateStemForest validateStemsForest.o prog.o loadSequences.o stem.o stemBinder.o -std=c++11 -DRANDSOURCE=7

所以我怀疑这是因为我最近在我的系统(ubuntu 14.04)上制作并安装了gcc-7.3.0。这曾经奏效,但现在不行了,我真的不明白为什么。 欢迎提出任何建议

谢谢: 丹

g++-7.3.0不编译

dan@chicabuntu:~/RNN/GAForest$ g++  -o validateStemForest validateStemsForest.o prog.o loadSequences.o stem.o stemBinder.o   -std=c++11 -DRANDSOURCE=7 -lm -lgomp  -L/usr/lib/x86_64-linux-gnu  -lboost_date_time

validateStemsForest.o: In function `unsigned short boost::date_time::month_str_to_ushort<boost::gregorian::greg_month>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
validateStemsForest.cpp:(.text._ZN5boost9date_time19month_str_to_ushortINS_9gregorian10greg_monthEEEtRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN5boost9date_time19month_str_to_ushortINS_9gregorian10greg_monthEEEtRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0xab): undefined reference to `boost::gregorian::greg_month::get_month_map_ptr[abi:cxx11]()'
这些库有我想要链接的函数

dan@chicabuntu:~/RNN/GAForest$ nm -D /usr/lib/x86_64-linux-gnu/libboost_date_time.so| grep get_month_map_ptr
0000000000008960 T _ZN5boost9gregorian10greg_month17get_month_map_ptrEv
图书馆就在这条路上

dan@chicabuntu:~/RNN/GAForest$ echo $LD_LIBRARY_PATH
/usr/local/cuda-8.0/lib64/:/usr/local/cuda/lib64:/usr/local/cuda-8.0/lib64/:/usr/local/cuda/lib64::/usr/local/lib:/usr/local/lib/x86_64-linux-gnu:/usr/lib/nvidia-375:/usr/local/lib:/usr/local/lib/x86_64-linux-gnu:/usr/lib/nvidia-375:/usr/lib:/usr/lib/x86_64-linux-gnu
以下是我正在使用的g++和boost版本:

dan@chicabuntu:~/RNN/GAForest$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/7.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-7.3.0/configure --disable-multilib
 Thread model: posixqqw
gcc version 7.3.0 (GCC)

dan@chicabuntu:~/RNN/GAForest$ dpkg -S /usr/include/boost/version.hpp
libboost1.54-dev: /usr/include/boost/version.hp

未定义符号末尾的[abi:cxx11]可能是一条线索。 新版本的gcc具有不同的ABI以支持c++11:。如果您的boost库是用旧的ABI编译的,那么它们将不会与用新的ABI编译的代码链接


请尝试使用
-D\u GLIBCXX\u USE\u cx11\u ABI=0构建代码,这就是问题所在-非常感谢!D_GLIBCXX_USE_cx11_ABI=0修复了编译,D_GLIBCXX_USE_cx11_ABI=1再次破坏了编译,证明这就是问题所在。非常感谢你的帮助@Dan欢迎来到Stackoverflow!很好,你的问题解决了。请阅读
dan@chicabuntu:~/RNN/GAForest$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/7.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-7.3.0/configure --disable-multilib
 Thread model: posixqqw
gcc version 7.3.0 (GCC)

dan@chicabuntu:~/RNN/GAForest$ dpkg -S /usr/include/boost/version.hpp
libboost1.54-dev: /usr/include/boost/version.hp