Ubuntu系统下使用ceres库,make提示如下错误
CMakeFiles/pose_estimation_3d2d.dir/pose_estimation_3d2d.cpp.o:在函数‘ceres::internal::FixedArray<double, 6ul, std::allocator<double> >::operator[](unsigned long)’中:
/usr/local/include/ceres/internal/fixed_array.h:215:对‘google::LogMessageFatal::LogMessageFatal(char const*, int, google::CheckOpString const&)’未定义的引用
/usr/local/include/ceres/internal/fixed_array.h:215:对‘google::LogMessage::stream()’未定义的引用
/usr/local/include/ceres/internal/fixed_array.h:215:对‘google::LogMessageFatal::~LogMessageFatal()’未定义的引用
/usr/local/include/ceres/internal/fixed_array.h:215:对‘google::LogMessageFatal::~LogMessageFatal()’未定义的引用
CMakeFiles/pose_estimation_3d2d.dir/pose_estimation_3d2d.cpp.o:在函数‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >* google::MakeCheckOpString<unsigned long, unsigned long>(unsigned long const&, unsigned long const&, char const*)’中:
/usr/include/glog/logging.h:692:对‘google::base::CheckOpMessageBuilder::CheckOpMessageBuilder(char const*)’未定义的引用
/usr/include/glog/logging.h:694:对‘google::base::CheckOpMessageBuilder::ForVar2()’未定义的引用
/usr/include/glog/logging.h:695:对‘google::base::CheckOpMessageBuilder::NewString[abi:cxx11]()’未定义的引用
/usr/include/glog/logging.h:692:对‘google::base::CheckOpMessageBuilder::~CheckOpMessageBuilder()’未定义的引用
/usr/include/glog/logging.h:692:对‘google::base::CheckOpMessageBuilder::~CheckOpMessageBuilder()’未定义的引用
collect2: error: ld returned 1 exit status
CMakeFiles/pose_estimation_3d2d.dir/build.make:111: recipe for target 'pose_estimation_3d2d' failed
make[2]: *** [pose_estimation_3d2d] Error 1
CMakeFiles/Makefile2:168: recipe for target 'CMakeFiles/pose_estimation_3d2d.dir/all' failed
make[1]: *** [CMakeFiles/pose_estimation_3d2d.dir/all] Error 2
Makefile:90: recipe for target 'all' failed
make: *** [all] Error 2
将CMakeLists.txt文件中设置为‘Release’不要设置为Debug即可解决此问题
set( CMAKE_BUILD_TYPE Release )