Undefined reference when linking on Ubuntu 20.04
Opened this issue · 1 comments
jose1711 commented
Building facecam
on Ubuntu 20.04:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
$ make
Scanning dependencies of target STATIC_autogen
[ 1%] Automatic MOC and UIC for target STATIC
[ 1%] Built target STATIC_autogen
Scanning dependencies of target STATIC
[ 1%] Building CXX object CMakeFiles/STATIC.dir/STATIC_autogen/mocs_compilation.cpp.o
[ 2%] Linking CXX static library libSTATIC.a
[ 2%] Built target STATIC
Scanning dependencies of target FaceCam_autogen
[ 3%] Automatic MOC and UIC for target FaceCam
[ 3%] Built target FaceCam_autogen
[ 4%] Automatic RCC for src/gui/darkstyle.qrc
[ 4%] Automatic RCC for resources.qrc
[ 5%] Automatic RCC for src/gui/framelesswindow.qrc
Scanning dependencies of target FaceCam
[ 5%] Building CXX object CMakeFiles/FaceCam.dir/FaceCam_autogen/mocs_compilation.cpp.o
[ 6%] Building CXX object CMakeFiles/FaceCam.dir/src/main.cpp.o
..
..
[ 35%] Building CXX object CMakeFiles/FaceCam.dir/FaceCam_autogen/MXUWEOXILK/qrc_darkstyle.cpp.o
[ 36%] Linking CXX executable bin/FaceCam
/usr/bin/ld: CMakeFiles/FaceCam.dir/src/file_storage.cpp.o: in function `ml_cam::FileStorage::initStorage()':
file_storage.cpp:(.text+0x637): undefined reference to `std::experimental::filesystem::v1::create_directories(std::experimental::filesystem::v1::__cxx11::path const&)'
/usr/bin/ld: file_storage.cpp:(.text+0x84b): undefined reference to `std::experimental::filesystem::v1::create_directories(std::experimental::filesystem::v1::__cxx11::path const&)'
/usr/bin/ld: CMakeFiles/FaceCam.dir/src/file_storage.cpp.o: in function `std::experimental::filesystem::v1::__cxx11::path::path(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)':
file_storage.cpp:(.text._ZNSt12experimental10filesystem2v17__cxx114pathC2EONSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZNSt12experimental10filesystem2v17__cxx114pathC5EONSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x50): undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: CMakeFiles/FaceCam.dir/src/file_storage.cpp.o: in function `std::experimental::filesystem::v1::__cxx11::path::clear()':
file_storage.cpp:(.text._ZNSt12experimental10filesystem2v17__cxx114path5clearEv[_ZNSt12experimental10filesystem2v17__cxx114path5clearEv]+0x24): undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: CMakeFiles/FaceCam.dir/src/file_storage.cpp.o: in function `std::experimental::filesystem::v1::__cxx11::path::_M_append(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
file_storage.cpp:(.text._ZNSt12experimental10filesystem2v17__cxx114path9_M_appendERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZNSt12experimental10filesystem2v17__cxx114path9_M_appendERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0xb6): undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: CMakeFiles/FaceCam.dir/src/file_storage.cpp.o: in function `std::experimental::filesystem::v1::exists(std::experimental::filesystem::v1::__cxx11::path const&)':
file_storage.cpp:(.text._ZNSt12experimental10filesystem2v16existsERKNS1_7__cxx114pathE[_ZNSt12experimental10filesystem2v16existsERKNS1_7__cxx114pathE]+0x18): undefined reference to `std::experimental::filesystem::v1::status(std::experimental::filesystem::v1::__cxx11::path const&)'
/usr/bin/ld: CMakeFiles/FaceCam.dir/src/file_storage.cpp.o: in function `std::experimental::filesystem::v1::is_directory(std::experimental::filesystem::v1::__cxx11::path const&)':
file_storage.cpp:(.text._ZNSt12experimental10filesystem2v112is_directoryERKNS1_7__cxx114pathE[_ZNSt12experimental10filesystem2v112is_directoryERKNS1_7__cxx114pathE]+0x18): undefined reference to `std::experimental::filesystem::v1::status(std::experimental::filesystem::v1::__cxx11::path const&)'
/usr/bin/ld: CMakeFiles/FaceCam.dir/src/file_storage.cpp.o: in function `std::experimental::filesystem::v1::__cxx11::path::path<char [8], std::experimental::filesystem::v1::__cxx11::path>(char const (&) [8])':
file_storage.cpp:(.text._ZNSt12experimental10filesystem2v17__cxx114pathC2IA8_cS3_EERKT_[_ZNSt12experimental10filesystem2v17__cxx114pathC5IA8_cS3_EERKT_]+0x6e): undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: CMakeFiles/FaceCam.dir/src/file_storage.cpp.o: in function `std::experimental::filesystem::v1::__cxx11::path::path<char [7], std::experimental::filesystem::v1::__cxx11::path>(char const (&) [7])':
file_storage.cpp:(.text._ZNSt12experimental10filesystem2v17__cxx114pathC2IA7_cS3_EERKT_[_ZNSt12experimental10filesystem2v17__cxx114pathC5IA7_cS3_EERKT_]+0x6e): undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: CMakeFiles/FaceCam.dir/src/face_detector/face_detector_cascade.cpp.o: in function `FaceDetectorCascade::FaceDetectorCascade(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
face_detector_cascade.cpp:(.text+0xab): undefined reference to `std::experimental::filesystem::v1::current_path[abi:cxx11]()'
/usr/bin/ld: face_detector_cascade.cpp:(.text+0xe1): undefined reference to `std::experimental::filesystem::v1::absolute(std::experimental::filesystem::v1::__cxx11::path const&, std::experimental::filesystem::v1::__cxx11::path const&)'
/usr/bin/ld: CMakeFiles/FaceCam.dir/src/face_detector/face_detector_cascade.cpp.o: in function `std::experimental::filesystem::v1::__cxx11::path::path<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::experimental::filesystem::v1::__cxx11::path>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
face_detector_cascade.cpp:(.text._ZNSt12experimental10filesystem2v17__cxx114pathC2INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES3_EERKT_[_ZNSt12experimental10filesystem2v17__cxx114pathC5INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES3_EERKT_]+0x74): undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: CMakeFiles/FaceCam.dir/src/face_detector/face_detector_ssd_resnet10.cpp.o: in function `FaceDetectorSSDResNet10::FaceDetectorSSDResNet10()':
face_detector_ssd_resnet10.cpp:(.text+0x163): undefined reference to `std::experimental::filesystem::v1::current_path[abi:cxx11]()'
/usr/bin/ld: face_detector_ssd_resnet10.cpp:(.text+0x19d): undefined reference to `std::experimental::filesystem::v1::absolute(std::experimental::filesystem::v1::__cxx11::path const&, std::experimental::filesystem::v1::__cxx11::path const&)'
/usr/bin/ld: face_detector_ssd_resnet10.cpp:(.text+0x1c4): undefined reference to `std::experimental::filesystem::v1::current_path[abi:cxx11]()'
/usr/bin/ld: face_detector_ssd_resnet10.cpp:(.text+0x1fe): undefined reference to `std::experimental::filesystem::v1::absolute(std::experimental::filesystem::v1::__cxx11::path const&, std::experimental::filesystem::v1::__cxx11::path const&)'
/usr/bin/ld: CMakeFiles/FaceCam.dir/src/face_landmark_detector/face_landmark_detector_kazemi.cpp.o: in function `FaceLandmarkDetectorKazemi::FaceLandmarkDetectorKazemi()':
face_landmark_detector_kazemi.cpp:(.text+0x123): undefined reference to `std::experimental::filesystem::v1::current_path[abi:cxx11]()'
/usr/bin/ld: face_landmark_detector_kazemi.cpp:(.text+0x15d): undefined reference to `std::experimental::filesystem::v1::absolute(std::experimental::filesystem::v1::__cxx11::path const&, std::experimental::filesystem::v1::__cxx11::path const&)'
/usr/bin/ld: CMakeFiles/FaceCam.dir/src/face_landmark_detector/face_landmark_detector_lbf.cpp.o: in function `FaceLandmarkDetectorLBF::FaceLandmarkDetectorLBF()':
face_landmark_detector_lbf.cpp:(.text+0x12f): undefined reference to `std::experimental::filesystem::v1::current_path[abi:cxx11]()'
/usr/bin/ld: face_landmark_detector_lbf.cpp:(.text+0x16c): undefined reference to `std::experimental::filesystem::v1::absolute(std::experimental::filesystem::v1::__cxx11::path const&, std::experimental::filesystem::v1::__cxx11::path const&)'
/usr/bin/ld: CMakeFiles/FaceCam.dir/src/face_landmark_detector/face_landmark_detector_syan_cnn.cpp.o: in function `FaceLandmarkDetectorSyanCNN::FaceLandmarkDetectorSyanCNN()':
face_landmark_detector_syan_cnn.cpp:(.text+0x101): undefined reference to `std::experimental::filesystem::v1::current_path[abi:cxx11]()'
/usr/bin/ld: face_landmark_detector_syan_cnn.cpp:(.text+0x13b): undefined reference to `std::experimental::filesystem::v1::absolute(std::experimental::filesystem::v1::__cxx11::path const&, std::experimental::filesystem::v1::__cxx11::path const&)'
/usr/bin/ld: CMakeFiles/FaceCam.dir/src/face_landmark_detector/face_landmark_detector_syan_cnn_2.cpp.o: in function `FaceLandmarkDetectorSyanCNN2::FaceLandmarkDetectorSyanCNN2()':
face_landmark_detector_syan_cnn_2.cpp:(.text+0x1a7): undefined reference to `std::experimental::filesystem::v1::current_path[abi:cxx11]()'
/usr/bin/ld: face_landmark_detector_syan_cnn_2.cpp:(.text+0x1e1): undefined reference to `std::experimental::filesystem::v1::absolute(std::experimental::filesystem::v1::__cxx11::path const&, std::experimental::filesystem::v1::__cxx11::path const&)'
/usr/bin/ld: face_landmark_detector_syan_cnn_2.cpp:(.text+0x208): undefined reference to `std::experimental::filesystem::v1::current_path[abi:cxx11]()'
/usr/bin/ld: face_landmark_detector_syan_cnn_2.cpp:(.text+0x242): undefined reference to `std::experimental::filesystem::v1::absolute(std::experimental::filesystem::v1::__cxx11::path const&, std::experimental::filesystem::v1::__cxx11::path const&)'
/usr/bin/ld: CMakeFiles/FaceCam.dir/src/effects/animation.cpp.o: in function `Animation::addFrame(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
animation.cpp:(.text+0xc1): undefined reference to `std::experimental::filesystem::v1::current_path[abi:cxx11]()'
/usr/bin/ld: animation.cpp:(.text+0xf7): undefined reference to `std::experimental::filesystem::v1::absolute(std::experimental::filesystem::v1::__cxx11::path const&, std::experimental::filesystem::v1::__cxx11::path const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/FaceCam.dir/build.make:846: bin/FaceCam] Error 1
make[1]: *** [CMakeFiles/Makefile2:128: CMakeFiles/FaceCam.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
vietanhdev commented
You can put this line to CMakeLists.txt
:
link_libraries(stdc++fs)