Relative Content

Tag Archive for c++opencvcmake

Cmake issue when trying to build project with opencv

I’ve spent 10 hours with no success, I’m trying to build a c++ project with opencv using cmake but I keep getting this error log below. There seems to be an issue with the CMakeDetermineCompilerId.cmake file but i don’t know what is the issue. Any help would be amazing as I’m pretty stuck right now.
Thanks in advance to whoever reads this.

OpenCV Include doesnt deliver references to cv Functions

i just got started with c++ and have been trying to use OpenCV for an GUI.
I installed Cmake, Ninja and OpenCV into my C:/ directory. I now planned to Build the Project but i get an error in the Linking stage of Compilation.
Here is the log:
[main] Building folder: opencvtest [main] Configuring project: opencvtest [proc] Executing command: "C:Program FilesCMakebincmake.EXE" --no-warn-unused-cli - DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -SC:/opencvtest -Bc:/ opencvtest/build -G Ninja [cmake] Not searching for unused variables given on the command line. [cmake] -- Configuring done (0.2s) [cmake] -- Generating done (0.1s) [cmake] -- Build files have been written to: C:/opencvtest/build [build] Starting build [proc] Executing command: chcp [proc] Executing command: "C:Program FilesCMakebincmake.EXE" --build c:/opencvtest/build -- config Debug --target all -- [build] [1/1 100% :: 0.205] Linking CXX executable opencvtest.exe [build] FAILED: opencvtest.exe [build] C:Windowssystem32cmd.exe /C "cd . && C:msys64ucrt64binc++.exe -g CMakeFiles/ opencvtest.dir/main.cpp.obj -o opencvtest.exe -Wl,--out-implib,libopencvtest.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -LC:/PROGRA~1/opencv/build/x64/vc16/lib -lopencv_world4100d -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ." [build] C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/ bin/ld.exe: CMakeFiles/opencvtest.dir/main.cpp.obj: in functionmain’:
[build] C:/opencvtest/main.cpp:8: undefined reference to cv::Mat::Mat()' [build] C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/opencvtest/main.cpp:19: undefined reference to cv::Mat::~Mat()’
[build] collect2.exe: error: ld returned 1 exit status
[build] ninja: build stopped: subcommand failed.
[proc] The command: “C:Program FilesCMakebincmake.EXE” –build c:/opencvtest/build –config Debug –target all — exited with code: 1
[driver] Build completed: 00:00:00.360
[build] Build finished with exit code 1
`