因此,当我使用命令make
时,我收到以下错误:
[jalal@goku c++]$ make
[ 25%] Building CXX object CMakeFiles/TestSVM.dir/TestSVM.cpp.o
[ 50%] Linking CXX executable TestSVM
CMakeFiles/TestSVM.dir/TestSVM.cpp.o: In function `__static_initialization_and_destruction_0(int, int)':
TestSVM.cpp:(.text+0x28c3): undefined reference to `USER_ERROR__inconsistent_build_configuration__see_dlib_faq_1_'
TestSVM.cpp:(.text+0x28cf): undefined reference to `USER_ERROR__inconsistent_build_configuration__see_dlib_faq_2'
collect2: error: ld returned 1 exit status
make[2]: *** [TestSVM] Error 1
make[1]: *** [CMakeFiles/TestSVM.dir/all] Error 2
make: *** [all] Error 2
文件如下:
[jalal@goku c++]$ ls
CMakeCache.txt CMakeFiles CMakeLists.txt Makefile TestSVM.cpp TrainSVM.cpp cmake_install.cmake json.hpp trained_svms
我使用此repo在源dlib
中构建了/scratch2/dlib
:https://github.com/davisking/dlib
按照以下命令:
mkdir build; cd build; cmake .. -DUSE_AVX_INSTRUCTIONS=1; cmake --build .
我不确定应该如何解决这个问题。 我在克隆的git repo中遵循以下命令:
$ cd c++
$ cmake .
$ make
https://github.com/sausax/pose_estimation
另外不确定如何理解这个以修复错误
https://github.com/davisking/dlib/blob/master/dlib/test_for_odr_violations.cpp
答案 0 :(得分:0)
正如评论者所说,不要忘记链接到dlib!您可以在CMake中执行以下操作:
target_link_libraries(<YOUR APP> dlib::dlib)
我无法简单地dlib
进行链接,但是我尝试了${dlib_LIBRARIES}
,最后CMake用以下方法来提示我:
CMake Warning at lib/cmake/dlib/dlibConfig.cmake:42 (message):
The variable 'dlib_LIBRARIES' is deprecated! Instead, simply use
target_link_libraries(your_app dlib::dlib). See
http://dlib.net/examples/CMakeLists.txt.html for an example.
ENABLE_ASSERTS
指向常见问题解答也让我分心,但这是由于我没有链接库而包含了。