1. Problem description
Compilation error
CMakeFiles/run_mapping_offline.dir/run_mapping_offline.cc.o: In function `__static_initialization_and_destruction_0':
/home/wong/workspace_demo/packagetest_faster_lio_ws/src/***/***/app/run_mapping_offline.cc:16: undefined reference to `google::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
/home/wong/workspace_demo/packagetest_faster_lio_ws/src/***/***/app/run_mapping_offline.cc:17: undefined reference to `google::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
/home/wong/workspace_demo/***/src/***/***/app/run_mapping_offline.cc:18: undefined reference to `google::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
/home/wong/workspace_demo/***/src/***/***/app/run_mapping_offline.cc:19: undefined reference to `google::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
collect2: error: ld returned 1 exit status
***/***/app/CMakeFiles/run_mapping_offline.dir/build.make:678: recipe for target '/home/wong/workspace_demo/***/devel/lib/faster_lio/run_mapping_offline' failed
2. Solution
Add the following line in CMakeLists.txt:
find_package(gflags REQUIRED)
This is our own solution. If you have any other better solutions, please leave a comment and let me know.
Read More:
- [Solved] PCL Compile Error: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>:: XXX
- [Solved] Compile the program error: undefined reference to `cv::dnn::dnn4_v20210301::Net::~Net()‘
- Clion new method shows undefined reference to solution
- error: undefined reference to `calculate()` [How to Solve]
- [Solved] Qt Error: undefined reference to xxxxx
- [Solved] cortex_M3 freeRTOS Error: undefined reference to `_sbrk‘
- [Solved] C++ error: undefined reference to `xxx‘
- [Solved] QT error: error: undefined reference to ` VTable`
- C++Qt development – Qtsocket programming error: undefined reference to `_imp__WSAStartup
- GCC Error:(.text+0x24): undefined reference to `main‘collect2: error: ld returned 1 exit status [Solved]
- [Solved] latex Compile llncs2e reference error locally
- [Solved] VScode Error: undefined reference to ‘WinMain’ collect2.exe: error: ld returned 1 exit status
- Google Play googleapi: Error 403: Google Play Android Developer API has not been used in project
- [Solved] QT Error: error: undefined reference to `GameModel::~GameModel()’
- [Solved] Overleaf Compile the Paper Error: LaText Error:Environment aligned undefined.
- ImportError: No module named google.protobuf.internal
- Angular_ Error: Cannot assign to a reference or variable!
- [Solved] C++ Error: Undefined symbols for architecture x86_64:
- C# Error: Import “google/protobuf/timestamp.proto“ was not found or had errors. [How to Solve]
- How to Solve Kotlin unresolved reference error