I intend to work with OpenCV C++ code with VScode in Windows 11 my VSCode compiler and make tools properly installed and work I use the following CMake file to debug my simple code, however, it can not detect the header library even manually set the header path in c_cpp_properties.json file my code
cmake_minimum_required(VERSION 3.0.0)
project(myopencv VERSION 0.1.0)
include(CTest)
enable_testing()
find_package(OpenCV REQUIRED)
include_directories($(OpenCV_DIR\include\opencv2))
include_directories($(OpenCV_DIR\x64\vc16\lib))
add_executable(myopencv main.cpp)
target_link_libraries(myopencv $OPENCV_LIBS)
#INCLUDE_DIRECTORIES($(OpenCV_DIR\x64\vc16\lib))
#add_library(OPENCV_LIBS $(OpenCV_DIR\x64\vc16\lib))
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
those are screenshots of the problem
[main] Configuring folder: opencv2
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=C:\cygwin64\bin\x86_64-pc-cygwin-gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\cygwin64\bin\x86_64-pc-cygwin-g++.exe -Sc:/Users/Mehrdad/Documents/PlatformIO/Projects/opencv2 -Bc:/Users/Mehrdad/Documents/PlatformIO/Projects/opencv2/build -G "Unix Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake] -- The C compiler identification is GNU 10.2.0
[cmake] -- The CXX compiler identification is GNU 10.2.0
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - failed
[cmake] -- Check for working C compiler: C:/cygwin64/bin/x86_64-pc-cygwin-gcc.exe
[cmake] -- Check for working C compiler: C:/cygwin64/bin/x86_64-pc-cygwin-gcc.exe - broken
[cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.18/Modules/CMakeTestCCompiler.cmake:66 (message):
[cmake] The C compiler
[cmake]
[cmake] "C:/cygwin64/bin/x86_64-pc-cygwin-gcc.exe"
[cmake]
[cmake] is not able to compile a simple test program.
[cmake]
[cmake] It fails with the following output:
[cmake]
[cmake] Change Dir: C:/Users/Mehrdad/Documents/PlatformIO/Projects/opencv2/build/CMakeFiles/CMakeTmp
[cmake]
[cmake] Run Build Command(s):C:/cygwin64/bin/make.exe cmTC_9053f/fast && /usr/bin/make -f CMakeFiles/cmTC_9053f.dir/build.make CMakeFiles/cmTC_9053f.dir/build
[cmake] make[1]: Entering directory '/cygdrive/c/Users/Mehrdad/Documents/PlatformIO/Projects/opencv2/build/CMakeFiles/CMakeTmp'
[cmake] Building C object CMakeFiles/cmTC_9053f.dir/testCCompiler.c.obj
[cmake] C:/cygwin64/bin/x86_64-pc-cygwin-gcc.exe -o CMakeFiles/cmTC_9053f.dir/testCCompiler.c.obj -c C:/Users/Mehrdad/Documents/PlatformIO/Projects/opencv2/build/CMakeFiles/CMakeTmp/testCCompiler.c
[cmake] Linking C executable cmTC_9053f.exe
[cmake] "C:/Program Files/CMake/bin/cmake.exe" -E rm -f CMakeFiles/cmTC_9053f.dir/objects.a
[cmake] CMAKE_AR-NOTFOUND cr CMakeFiles/cmTC_9053f.dir/objects.a @CMakeFiles/cmTC_9053f.dir/objects1.rsp
[cmake] make[1]: CMAKE_AR-NOTFOUND: No such file or directory
[cmake] make[1]: *** [CMakeFiles/cmTC_9053f.dir/build.make:107: cmTC_9053f.exe] Error 127
[cmake] make[1]: Leaving directory '/cygdrive/c/Users/Mehrdad/Documents/PlatformIO/Projects/opencv2/build/CMakeFiles/CMakeTmp'
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "C:/Users/Mehrdad/Documents/PlatformIO/Projects/opencv2/build/CMakeFiles/CMakeOutput.log".
[cmake] See also "C:/Users/Mehrdad/Documents/PlatformIO/Projects/opencv2/build/CMakeFiles/CMakeError.log".
[cmake] make: *** [Makefile:140: cmTC_9053f/fast] Error 2
[cmake]
[cmake]
[cmake]
[cmake]
[cmake]
[cmake] CMake will not be able to correctly generate this project.
[cmake] Call Stack (most recent call first):
[cmake] CMakeLists.txt:2 (project)
[cmake]
[cmake]
[proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=C:\cygwin64\bin\x86_64-pc-cygwin-gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\cygwin64\bin\x86_64-pc-cygwin-g++.exe -Sc:/Users/Mehrdad/Documents/PlatformIO/Projects/opencv2 -Bc:/Users/Mehrdad/Documents/PlatformIO/Projects/opencv2/build -G "Unix Makefiles" exited with code: 1 and signal: null