ShunChengWu / SceneGraphFusion

BSD 2-Clause "Simplified" License
160 stars 26 forks source link

Compilation Error: `Renderer` Constructor Argument Mismatch #33

Closed tabbabb closed 1 month ago

tabbabb commented 3 months ago

I encountered a compilation error when trying to build the GraphSLAM component of the SceneGraphFusion project. The error indicates a mismatch in the arguments passed to the Renderer constructor. Below are the details:

Environment: OS: Ubuntu 20.04 Compiler: GCC 11 Project: SceneGraphFusion File Path: SceneGraphFusion/app/GraphSLAM/main.cc OpenCV Version: 4.x

Issue: In the file SceneGraphFusion/app/GraphSLAM/main.cc, at line 167, an attempt is made to call the Renderer constructor, resulting in the following error: /usr/include/c++/11/bits/unique_ptr.h:962:30: error: no matching function for call to ‘Renderer::Renderer(short unsigned int&, short unsigned int&, std::__cxx11::basic_string<char>&, bool)’

but it was found that the Renderer constructor only accepts 3 parameters: Renderer(int width, int height, const std::string &path)

However, in main.cc, the constructor is invoked with 4 parameters: std::make_unique<Renderer>(width, height, path, some_boolean)

Compilation Output:

[ 33%] Built target libDataLoader
[ 83%] Built target libGraphSLAM
[ 91%] Building CXX object app/GraphSLAM/CMakeFiles/exe_GraphSLAM.dir/main.cc.o
...
/usr/include/c++/11/bits/unique_ptr.h:962:30: error: no matching function for call to ‘Renderer::Renderer(short unsigned int&, short unsigned int&, std::__cxx11::basic_string<char>&, bool)’
...
make[2]: *** [app/GraphSLAM/CMakeFiles/exe_GraphSLAM.dir/build.make:76: app/GraphSLAM/CMakeFiles/exe_GraphSLAM.dir/main.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:202: app/GraphSLAM/CMakeFiles/exe_GraphSLAM.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

How should I do to complete the compilation?

ShunChengWu commented 3 months ago

It seems like a c++11 issue. If you search online, there should be a lot of solutions. Check Stackoverflow maybe?

jaewonbae commented 2 weeks ago

I found the solution to this issue.

The error occurs because the arguments passed to the Renderer class constructor do not match the required arguments. Specifically, the Renderer constructor expects three arguments, but four are being provided in the call.

To resolve this, you can update line 126 in app/GraphSLAM/main.cc as follows:

Before:

Renderer(int width, int height, const std::string &path){

After:

Renderer(int width, int height, const std::string &path, bool align){

This should resolve the mismatch in arguments.