I am trying to add some opencv code to the detectnet-console and detectnet-camrea cpp files in the jetson-inference tutorial. BUT when i build the model it shows me the following error
[ 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
which i have searched for a solution and the problem is when compiling i need to add this
pkg-config opencv --cflags --libs
but i dont know which part of the cmake i should add it to .
any help in this matter