Compiling error: undefined reference to `google::base::CheckOpMessageBuilder::NewString[abi:cxx11]()' #291

Open
Yamin05114 opened this Issue Jun 9, 2017 · 3 comments

Comments

Projects
None yet
2 participants

Hi I came across this error when compiling, thanks in advance:
[ 54%] Linking CXX executable ../bin/nist CMakeFiles/nist.dir/nist.cc.o: In functionstd::__cxx11::basic_string<char, std::char_traits, std::allocator >* google::MakeCheckOpString<int, int>(int const&, int const&, char const*)':
nist.cc:(.text._ZN6google17MakeCheckOpStringIiiEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIiiEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc]+0x49): undefined reference to google::base::CheckOpMessageBuilder::NewString[abi:cxx11]()' ../lib/libceres.a(problem_impl.cc.o): In functionstd::__cxx11::basic_string<char, std::char_traits, std::allocator >* google::MakeCheckOpString<unsigned long, unsigned long>(unsigned long const&, unsigned long const&, char const*)':
problem_impl.cc:(.text._ZN6google17MakeCheckOpStringImmEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc[_ZN6google17MakeCheckOpStringImmEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc]+0x51): undefined reference to google::base::CheckOpMessageBuilder::NewString[abi:cxx11]()' ../lib/libceres.a(problem_impl.cc.o): In functionstd::__cxx11::basic_string<char, std::char_traits, std::allocator >* google::MakeCheckOpString<ceres::internal::ParameterBlock*, ceres::internal::ParameterBlock*>(ceres::internal::ParameterBlock* const&, ceres::internal::ParameterBlock* const&, char const*)':
problem_impl.cc:(.text._ZN6google17MakeCheckOpStringIPN5ceres8internal14ParameterBlockES4_EEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIPN5ceres8internal14ParameterBlockES4_EEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc]+0x51): undefined reference to google::base::CheckOpMessageBuilder::NewString[abi:cxx11]()' ../lib/libceres.a(triplet_sparse_matrix.cc.o): In functionstd::__cxx11::basic_string<char, std::char_traits, std::allocator >* google::MakeCheckOpString<double, double>(double const&, double const&, char const*)':
triplet_sparse_matrix.cc:(.text._ZN6google17MakeCheckOpStringIddEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIddEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc]+0x54): undefined reference to google::base::CheckOpMessageBuilder::NewString[abi:cxx11]()' ../lib/libceres.a(compressed_row_sparse_matrix.cc.o): In functionstd::__cxx11::basic_string<char, std::char_traits, std::allocator >* google::MakeCheckOpString<int, unsigned long>(int const&, unsigned long const&, char const*)':
compressed_row_sparse_matrix.cc:(.text._ZN6google17MakeCheckOpStringIimEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIimEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc]+0x51): undefined reference to google::base::CheckOpMessageBuilder::NewString[abi:cxx11]()' ../lib/libceres.a(compressed_row_sparse_matrix.cc.o):compressed_row_sparse_matrix.cc:(.text._ZN6google17MakeCheckOpStringImiEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc[_ZN6google17MakeCheckOpStringImiEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc]+0x50): more undefined references togoogle::base::CheckOpMessageBuilder::NewStringabi:cxx11' follow
collect2: error: ld returned 1 exit status
examples/CMakeFiles/nist.dir/build.make:114: recipe for target 'bin/nist' failed
make[2]: *** [bin/nist] Error 1
CMakeFiles/Makefile2:3653: recipe for target 'examples/CMakeFiles/nist.dir/all' failed
make[1]: *** [examples/CMakeFiles/nist.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2`

I wonder if I have installed any of the libs wrong, but I can not find it out.

Contributor

alexsmac commented Jun 9, 2017

You are compiling Ceres with CXX11 enabled, but have not compiled glog with C++11 enabled.

@alexsmac Should I compile glog again with CXX11 or just turn off CXX11 of Ceres

I solved the problem by rebuild the glog from source file. But new problem came out like the following:
[ 98%] Linking CXX executable ../bin/denoising CMakeFiles/denoising.dir/denoising.cc.o: In functionmain':
denoising.cc:(.text.startup+0x67): undefined reference to google::SetUsageMessage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' collect2: error: ld returned 1 exit status examples/CMakeFiles/denoising.dir/build.make:140: recipe for target 'bin/denoising' failed make[2]: *** [bin/denoising] Error 1 CMakeFiles/Makefile2:3875: recipe for target 'examples/CMakeFiles/denoising.dir/all' failed make[1]: *** [examples/CMakeFiles/denoising.dir/all] Error 2 Makefile:138: recipe for target 'all' failed make: *** [all] Error 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment