我正在尝试在jetson-inference教程中将一些opencv代码添加到detectnet-console和detectnet-camrea cpp文件中。 但是当我建立模型时,它显示了以下错误
[ 74%] Linking CXX executable ../aarch64/bin/detectnet-console
CMakeFiles/detectnet-console.dir/detectnet-console.cpp.o: In function cv::String::String(char const*)': detectnet-console.cpp:(.text._ZN2cv6StringC2EPKc[_ZN2cv6StringC5EPKc]+0x4c): undefined reference to cv::String::allocate(unsigned long)'
CMakeFiles/detectnet-console.dir/detectnet-console.cpp.o: In function cv::String::~String()': detectnet-console.cpp:(.text._ZN2cv6StringD2Ev[_ZN2cv6StringD5Ev]+0x10): undefined reference to cv::String::deallocate()'
CMakeFiles/detectnet-console.dir/detectnet-console.cpp.o: In function cv::Mat::Mat(int, int, int, void*, unsigned long)': detectnet-console.cpp:(.text._ZN2cv3MatC2EiiiPvm[_ZN2cv3MatC5EiiiPvm]+0x144): undefined reference to cv::error(int, cv::String const&, char const*, char const*, int)'
detectnet-console.cpp:(.text._ZN2cv3MatC2EiiiPvm[_ZN2cv3MatC5EiiiPvm]+0x258): undefined reference to cv::error(int, cv::String const&, char const*, char const*, int)' CMakeFiles/detectnet-console.dir/detectnet-console.cpp.o: In function cv::Mat::~Mat()':
detectnet-console.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x34): undefined reference to cv::fastFree(void*)' CMakeFiles/detectnet-console.dir/detectnet-console.cpp.o: In function cv::Mat::release()':
detectnet-console.cpp:(.text._ZN2cv3Mat7releaseEv[_ZN2cv3Mat7releaseEv]+0x58): undefined reference to `cv::Mat::deallocate()'
collect2: error: ld returned 1 exit status
detectnet-console/CMakeFiles/detectnet-console.dir/build.make:102: recipe for target 'aarch64/bin/detectnet-console' failed
make[2]: *** [aarch64/bin/detectnet-console] Error 1
CMakeFiles/Makefile2:235: recipe for target 'detectnet-console/CMakeFiles/detectnet-console.dir/all' failed
make[1]: *** [detectnet-console/CMakeFiles/detectnet-console.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
我在寻找解决方案 问题是在编译时我需要添加这个
pkg-config opencv --cflags --libs
但是我不知道我应该将cmake的哪一部分添加到其中。
此事的任何帮助