I am trying to build ORB_SLAM3 locally. As part of my attempt to fix compile errors, I replaced the project's outdated copy of g2o with the latest version.
I am not sure if change of version caused the error shown in the title. I tried to trace down the source code but could not find a solution on myself. Although this may not be an issue of g2o itself, I would really appreciate some help to fix it.
To provide more context, my work-in-progress fork of ORB_SLAM3 can be found here. The problematic code is located here.
The original code from existing ORB_SLAM3 project looks like this:
g2o::SparseOptimizer optimizer;
g2o::BlockSolver_6_3::LinearSolverType * linearSolver;
linearSolver = new g2o::LinearSolverEigen<g2o::BlockSolver_6_3::PoseMatrixType>();
g2o::BlockSolver_6_3 * solver_ptr = new g2o::BlockSolver_6_3(linearSolver);
g2o::OptimizationAlgorithmLevenberg* solver = new g2o::OptimizationAlgorithmLevenberg(solver_ptr);
It failed to compile because new g2o::BlockSolver expects unique_ptr in the latest version.
My modified version looks like this:
I used std::make_unique on linearSolver to fix the issue above.
g2o::SparseOptimizer optimizer;
auto linearSolver = std::make_unique<g2o::LinearSolverEigen<g2o::BlockSolver_6_3::PoseMatrixType>>();
auto solver_ptr = new g2o::BlockSolver_6_3(linearSolver);
auto solver = new g2o::OptimizationAlgorithmLevenberg(solver_ptr);
This version produces the error shown in the title.
Attached is the raw error output from my compiler (I tried both GCC and Clang, both produced the same error): gcc_compile_log.txt
GCC Version: gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0
Clang Version: Ubuntu clang version 18.1.3 (1ubuntu1)
I am trying to build ORB_SLAM3 locally. As part of my attempt to fix compile errors, I replaced the project's outdated copy of g2o with the latest version.
I am not sure if change of version caused the error shown in the title. I tried to trace down the source code but could not find a solution on myself. Although this may not be an issue of g2o itself, I would really appreciate some help to fix it.
To provide more context, my work-in-progress fork of ORB_SLAM3 can be found here. The problematic code is located here.
The original code from existing ORB_SLAM3 project looks like this:
It failed to compile because
new g2o::BlockSolver
expectsunique_ptr
in the latest version.My modified version looks like this:
I used
std::make_unique
onlinearSolver
to fix the issue above.This version produces the error shown in the title.
Attached is the raw error output from my compiler (I tried both GCC and Clang, both produced the same error): gcc_compile_log.txt
GCC Version:
gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0
Clang Version:
Ubuntu clang version 18.1.3 (1ubuntu1)
Again, many thanks!