簡體   English   中英

編譯錯誤ceres庫示例程序“helloworld”

[英]Compiling error ceres library example program "helloworld"

我嘗試使用gcc helloworld.cc在示例中運行 Ceres 庫程序 我檢查了所有的庫都在/usr/local/lib 我已經按照以下說明安裝了gloggflag egien 我已經嘗試給出庫的明確路徑。

我想我有鏈接器錯誤,但無法弄清楚如何解決它。

/tmp/ccTx2jwX.o: In function `main':
helloworld.cc:(.text+0xc4): undefined reference to `google::InitGoogleLogging(char const*)'
helloworld.cc:(.text+0xf2): undefined reference to `ceres::Problem::Problem()'
helloworld.cc:(.text+0x143): undefined reference to `ceres::Problem::AddResidualBlock(ceres::CostFunction*, ceres::LossFunction*, double*)'
helloworld.cc:(.text+0x168): undefined reference to `ceres::Solver::Summary::Summary()'
helloworld.cc:(.text+0x188): undefined reference to `ceres::Solve(ceres::Solver::Options const&, ceres::Problem*, ceres::Solver::Summary*)'
helloworld.cc:(.text+0x1a1): undefined reference to `ceres::Solver::Summary::BriefReport() const'
helloworld.cc:(.text+0x26b): undefined reference to `ceres::Problem::~Problem()'
helloworld.cc:(.text+0x2cd): undefined reference to `ceres::Problem::~Problem()'
/tmp/ccTx2jwX.o: In function `ceres::AutoDiffCostFunction<CostFunctor, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0>::AutoDiffCostFunction(CostFunctor*)':
helloworld.cc:(.text._ZN5ceres20AutoDiffCostFunctionI11CostFunctorLi1ELi1ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0EEC2EPS1_[_ZN5ceres20AutoDiffCostFunctionI11CostFunctorLi1ELi1ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0EEC5EPS1_]+0xb1): undefined reference to `google::LogMessageFatal::LogMessageFatal(char const*, int, google::CheckOpString const&)'
helloworld.cc:(.text._ZN5ceres20AutoDiffCostFunctionI11CostFunctorLi1ELi1ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0EEC2EPS1_[_ZN5ceres20AutoDiffCostFunctionI11CostFunctorLi1ELi1ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0EEC5EPS1_]+0xbd): undefined reference to `google::LogMessage::stream()'
helloworld.cc:(.text._ZN5ceres20AutoDiffCostFunctionI11CostFunctorLi1ELi1ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0EEC2EPS1_[_ZN5ceres20AutoDiffCostFunctionI11CostFunctorLi1ELi1ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0EEC5EPS1_]+0xe3): undefined reference to `google::LogMessageFatal::~LogMessageFatal()'
helloworld.cc:(.text._ZN5ceres20AutoDiffCostFunctionI11CostFunctorLi1ELi1ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0EEC2EPS1_[_ZN5ceres20AutoDiffCostFunctionI11CostFunctorLi1ELi1ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0EEC5EPS1_]+0xef): undefined reference to `google::LogMessageFatal::~LogMessageFatal()'
/tmp/ccTx2jwX.o: In function `std::string* google::MakeCheckOpString<int, int>(int const&, int const&, char const*)':
helloworld.cc:(.text._ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKc]+0x24): undefined reference to `google::base::CheckOpMessageBuilder::CheckOpMessageBuilder(char const*)'
helloworld.cc:(.text._ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKc]+0x4b): undefined reference to `google::base::CheckOpMessageBuilder::ForVar2()'
helloworld.cc:(.text._ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKc]+0x66): undefined reference to `google::base::CheckOpMessageBuilder::NewString()'
helloworld.cc:(.text._ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKc]+0x75): undefined reference to `google::base::CheckOpMessageBuilder::~CheckOpMessageBuilder()'
helloworld.cc:(.text._ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKc]+0x89): undefined reference to `google::base::CheckOpMessageBuilder::~CheckOpMessageBuilder()'
/tmp/ccTx2jwX.o: In function `std::string* google::MakeCheckOpString<int, ceres::DimensionType>(int const&, ceres::DimensionType const&, char const*)':
helloworld.cc:(.text._ZN6google17MakeCheckOpStringIiN5ceres13DimensionTypeEEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIiN5ceres13DimensionTypeEEEPSsRKT_RKT0_PKc]+0x24): undefined reference to `google::base::CheckOpMessageBuilder::CheckOpMessageBuilder(char const*)'
helloworld.cc:(.text._ZN6google17MakeCheckOpStringIiN5ceres13DimensionTypeEEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIiN5ceres13DimensionTypeEEEPSsRKT_RKT0_PKc]+0x4b): undefined reference to `google::base::CheckOpMessageBuilder::ForVar2()'
helloworld.cc:(.text._ZN6google17MakeCheckOpStringIiN5ceres13DimensionTypeEEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIiN5ceres13DimensionTypeEEEPSsRKT_RKT0_PKc]+0x66): undefined reference to `google::base::CheckOpMessageBuilder::NewString()'
helloworld.cc:(.text._ZN6google17MakeCheckOpStringIiN5ceres13DimensionTypeEEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIiN5ceres13DimensionTypeEEEPSsRKT_RKT0_PKc]+0x75): undefined reference to `google::base::CheckOpMessageBuilder::~CheckOpMessageBuilder()'
helloworld.cc:(.text._ZN6google17MakeCheckOpStringIiN5ceres13DimensionTypeEEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIiN5ceres13DimensionTypeEEEPSsRKT_RKT0_PKc]+0x89): undefined reference to `google::base::CheckOpMessageBuilder::~CheckOpMessageBuilder()'
/tmp/ccTx2jwX.o: In function `ceres::internal::AutoDiff<CostFunctor, double, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0>::Differentiate(CostFunctor const&, double const* const*, int, double*, double**)':
helloworld.cc:(.text._ZN5ceres8internal8AutoDiffI11CostFunctordLi1ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0EE13DifferentiateERKS2_PKPKdiPdPSA_[_ZN5ceres8internal8AutoDiffI11CostFunctordLi1ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0EE13DifferentiateERKS2_PKPKdiPdPSA_]+0x9e): undefined reference to `google::LogMessageFatal::LogMessageFatal(char const*, int, google::CheckOpString const&)'
helloworld.cc:(.text._ZN5ceres8internal8AutoDiffI11CostFunctordLi1ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0EE13DifferentiateERKS2_PKPKdiPdPSA_[_ZN5ceres8internal8AutoDiffI11CostFunctordLi1ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0EE13DifferentiateERKS2_PKPKdiPdPSA_]+0xad): undefined reference to `google::LogMessage::stream()'
helloworld.cc:(.text._ZN5ceres8internal8AutoDiffI11CostFunctordLi1ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0EE13DifferentiateERKS2_PKPKdiPdPSA_[_ZN5ceres8internal8AutoDiffI11CostFunctordLi1ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0EE13DifferentiateERKS2_PKPKdiPdPSA_]+0xbc): undefined reference to `google::LogMessageFatal::~LogMessageFatal()'
helloworld.cc:(.text._ZN5ceres8internal8AutoDiffI11CostFunctordLi1ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0EE13DifferentiateERKS2_PKPKdiPdPSA_[_ZN5ceres8internal8AutoDiffI11CostFunctordLi1ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0ELi0EE13DifferentiateERKS2_PKPKdiPdPSA_]+0x324): undefined reference to `google::LogMessageFatal::~LogMessageFatal()'
/tmp/ccTx2jwX.o: In function `void ceres::internal::Make1stOrderPerturbation<ceres::Jet<double, 1>, double, 1>(int, double const*, ceres::Jet<double, 1>*)':
helloworld.cc:(.text._ZN5ceres8internal24Make1stOrderPerturbationINS_3JetIdLi1EEEdLi1EEEviPKT0_PT_[_ZN5ceres8internal24Make1stOrderPerturbationINS_3JetIdLi1EEEdLi1EEEviPKT0_PT_]+0x45): undefined reference to `google::LogMessageFatal::LogMessageFatal(char const*, int)'
helloworld.cc:(.text._ZN5ceres8internal24Make1stOrderPerturbationINS_3JetIdLi1EEEdLi1EEEviPKT0_PT_[_ZN5ceres8internal24Make1stOrderPerturbationINS_3JetIdLi1EEEdLi1EEEviPKT0_PT_]+0x56): undefined reference to `google::LogMessage::stream()'
helloworld.cc:(.text._ZN5ceres8internal24Make1stOrderPerturbationINS_3JetIdLi1EEEdLi1EEEviPKT0_PT_[_ZN5ceres8internal24Make1stOrderPerturbationINS_3JetIdLi1EEEdLi1EEEviPKT0_PT_]+0x9b): undefined reference to `google::LogMessageFatal::~LogMessageFatal()'
helloworld.cc:(.text._ZN5ceres8internal24Make1stOrderPerturbationINS_3JetIdLi1EEEdLi1EEEviPKT0_PT_[_ZN5ceres8internal24Make1stOrderPerturbationINS_3JetIdLi1EEEdLi1EEEviPKT0_PT_]+0xcd): undefined reference to `google::LogMessageFatal::LogMessageFatal(char const*, int)'
helloworld.cc:(.text._ZN5ceres8internal24Make1stOrderPerturbationINS_3JetIdLi1EEEdLi1EEEviPKT0_PT_[_ZN5ceres8internal24Make1stOrderPerturbationINS_3JetIdLi1EEEdLi1EEEviPKT0_PT_]+0xde): undefined reference to `google::LogMessage::stream()'
helloworld.cc:(.text._ZN5ceres8internal24Make1stOrderPerturbationINS_3JetIdLi1EEEdLi1EEEviPKT0_PT_[_ZN5ceres8internal24Make1stOrderPerturbationINS_3JetIdLi1EEEdLi1EEEviPKT0_PT_]+0x123): undefined reference to `google::LogMessageFatal::~LogMessageFatal()'
helloworld.cc:(.text._ZN5ceres8internal24Make1stOrderPerturbationINS_3JetIdLi1EEEdLi1EEEviPKT0_PT_[_ZN5ceres8internal24Make1stOrderPerturbationINS_3JetIdLi1EEEdLi1EEEviPKT0_PT_]+0x1dd): undefined reference to `google::LogMessageFatal::~LogMessageFatal()'
helloworld.cc:(.text._ZN5ceres8internal24Make1stOrderPerturbationINS_3JetIdLi1EEEdLi1EEEviPKT0_PT_[_ZN5ceres8internal24Make1stOrderPerturbationINS_3JetIdLi1EEEdLi1EEEviPKT0_PT_]+0x1fa): undefined reference to `google::LogMessageFatal::~LogMessageFatal()'
/tmp/ccTx2jwX.o: In function `void ceres::internal::Take0thOrderPart<ceres::Jet<double, 1>, double*>(int, ceres::Jet<double, 1> const*, double*)':
helloworld.cc:(.text._ZN5ceres8internal16Take0thOrderPartINS_3JetIdLi1EEEPdEEviPKT_T0_[_ZN5ceres8internal16Take0thOrderPartINS_3JetIdLi1EEEPdEEviPKT_T0_]+0x45): undefined reference to `google::LogMessageFatal::LogMessageFatal(char const*, int)'
helloworld.cc:(.text._ZN5ceres8internal16Take0thOrderPartINS_3JetIdLi1EEEPdEEviPKT_T0_[_ZN5ceres8internal16Take0thOrderPartINS_3JetIdLi1EEEPdEEviPKT_T0_]+0x56): undefined reference to `google::LogMessage::stream()'
helloworld.cc:(.text._ZN5ceres8internal16Take0thOrderPartINS_3JetIdLi1EEEPdEEviPKT_T0_[_ZN5ceres8internal16Take0thOrderPartINS_3JetIdLi1EEEPdEEviPKT_T0_]+0x9b): undefined reference to `google::LogMessageFatal::~LogMessageFatal()'
helloworld.cc:(.text._ZN5ceres8internal16Take0thOrderPartINS_3JetIdLi1EEEPdEEviPKT_T0_[_ZN5ceres8internal16Take0thOrderPartINS_3JetIdLi1EEEPdEEviPKT_T0_]+0xf4): undefined reference to `google::LogMessageFatal::~LogMessageFatal()'
/tmp/ccTx2jwX.o: In function `void ceres::internal::Take1stOrderPart<ceres::Jet<double, 1>, double, 0, 1>(int, ceres::Jet<double, 1> const*, double*)':
helloworld.cc:(.text._ZN5ceres8internal16Take1stOrderPartINS_3JetIdLi1EEEdLi0ELi1EEEviPKT_PT0_[_ZN5ceres8internal16Take1stOrderPartINS_3JetIdLi1EEEdLi0ELi1EEEviPKT_PT0_]+0x54): undefined reference to `google::LogMessageFatal::LogMessageFatal(char const*, int)'
helloworld.cc:(.text._ZN5ceres8internal16Take1stOrderPartINS_3JetIdLi1EEEdLi0ELi1EEEviPKT_PT0_[_ZN5ceres8internal16Take1stOrderPartINS_3JetIdLi1EEEdLi0ELi1EEEviPKT_PT0_]+0x65): undefined reference to `google::LogMessage::stream()'
helloworld.cc:(.text._ZN5ceres8internal16Take1stOrderPartINS_3JetIdLi1EEEdLi0ELi1EEEviPKT_PT0_[_ZN5ceres8internal16Take1stOrderPartINS_3JetIdLi1EEEdLi0ELi1EEEviPKT_PT0_]+0xb0): undefined reference to `google::LogMessageFatal::~LogMessageFatal()'
helloworld.cc:(.text._ZN5ceres8internal16Take1stOrderPartINS_3JetIdLi1EEEdLi0ELi1EEEviPKT_PT0_[_ZN5ceres8internal16Take1stOrderPartINS_3JetIdLi1EEEdLi0ELi1EEEviPKT_PT0_]+0xe5): undefined reference to `google::LogMessageFatal::LogMessageFatal(char const*, int)'
helloworld.cc:(.text._ZN5ceres8internal16Take1stOrderPartINS_3JetIdLi1EEEdLi0ELi1EEEviPKT_PT0_[_ZN5ceres8internal16Take1stOrderPartINS_3JetIdLi1EEEdLi0ELi1EEEviPKT_PT0_]+0xf6): undefined reference to `google::LogMessage::stream()'
helloworld.cc:(.text._ZN5ceres8internal16Take1stOrderPartINS_3JetIdLi1EEEdLi0ELi1EEEviPKT_PT0_[_ZN5ceres8internal16Take1stOrderPartINS_3JetIdLi1EEEdLi0ELi1EEEviPKT_PT0_]+0x141): undefined reference to `google::LogMessageFatal::~LogMessageFatal()'
helloworld.cc:(.text._ZN5ceres8internal16Take1stOrderPartINS_3JetIdLi1EEEdLi0ELi1EEEviPKT_PT0_[_ZN5ceres8internal16Take1stOrderPartINS_3JetIdLi1EEEdLi0ELi1EEEviPKT_PT0_]+0x1f4): undefined reference to `google::LogMessageFatal::~LogMessageFatal()'
helloworld.cc:(.text._ZN5ceres8internal16Take1stOrderPartINS_3JetIdLi1EEEdLi0ELi1EEEviPKT_PT0_[_ZN5ceres8internal16Take1stOrderPartINS_3JetIdLi1EEEdLi0ELi1EEEviPKT_PT0_]+0x211): undefined reference to `google::LogMessageFatal::~LogMessageFatal()'
collect2: error: ld returned 1 exit status

在 debian 上,我使用以下命令成功編譯了它:

g++ -I /usr/include/ -I /usr/include/eigen3 -I /usr/include/glog -l glog -l ceres helloworld.cc

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM