一起做RGB-D-SLAM(6)g2o報錯error: no matching function

kinetic_sharpen發表於2020-10-12

編譯高翔一起做RGB-D-SLAM

新增g2o後
make報錯:

slamEnd.cpp:72:104: error: no matching function for call to ‘g2o::OptimizationAlgorithmLevenberg::OptimizationAlgorithmLevenberg(SlamBlockSolver*&)’
 o::OptimizationAlgorithmLevenberg* solver = new g2o::OptimizationAlgorithmLevenberg( blockSolver );

將原始碼68行和69行,如下:

SlamBlockSolver* blockSolver = new SlamBlockSolver( linearSolver );
    g2o::OptimizationAlgorithmLevenberg* solver = new g2o::OptimizationAlgorithmLevenberg( blockSolver );

替換為:

SlamBlockSolver* blockSolver = new SlamBlockSolver(unique_ptr<SlamBlockSolver::LinearSolverType> (linearSolver));
    g2o::OptimizationAlgorithmLevenberg* solver = new g2o::OptimizationAlgorithmLevenberg(unique_ptr<g2o::Solver>(blockSolver));

重新編譯,成功:
在這裡插入圖片描述

相關文章