2017-06-27 24 views
0

我在Ubuntu上安裝穀神星和使用所有的命令行中http://ceres-solver.org/installation.html Linux的部分來自 命令和apt-get安裝libgoogle,考勤記錄-dev的 一路 使安裝 看來我安裝ceres求解器和它的依賴沒有問題。 但是,當我嘗試運行測試文件 bin/simple_bundle_adjuster ../ceres-solver-1.12.0/data/problem-16-22106-pre.txt 它顯示 無法打開文件../ceres-solver -1.9.0/data/problem-16-22106-pre.tx 然後我嘗試在教程中使用命令編譯helloworld g ++ -I/usr/include/eigen3 helloworld.cpp -o helloworld 它給了我一堆問題。
未定義的引用google::InitGoogleLogging(char const*)' helloworld.cpp:(.text+0x104): undefined reference to ceres ::問題::問題()' helloworld.cpp :(。text + 0x155):未定義引用到`ceres :: Problem :: AddResidualBlock(ceres :: CostFunction *,ceres :: LossFunction *,double *)' 我沒有全部列出。但似乎根本找不到有關谷歌的東西。 希望你能幫助我!它給了我一堆問題。不能使用穀神星解算器,考勤記錄

回答

0

聽起來像你沒有鏈接到圖書館;這會導致引用未定義。如果您正在調用鏈接器(G ++可以是鏈接器),那麼添加-lglog添加結尾,然後將其鏈接到glog。

同樣,你也應該鏈接到ceres。

下面是我需要鏈接到使用Ceres的庫的一些代碼片段。在CMake中。我建議你從底部開始,然後在頂部添加一些東西來解決,你可能需要用-l前綴來表示你需要鏈接它們。 我推薦使用cmake,這樣你可以簡單地將這個列表粘貼到target_link_libraries(我的可執行文件listhere)中,並刪除不必要的/未使用的庫;

umfpack 
    cxsparse 
    stlplus 
    glog 
    gomp 
    ccolamd 
    btf 
    klu 
    cholmod 
    lapack 
    blas 
    camd 
    amd 
    pthread 
    ceres 
+0

謝謝!我已經鏈接到ceres! –