When trying to build my code with cmake, I get following message in the Output on vscode:
[proc] Executing command: cmake --version
[proc] Executing command: cmake -E capabilities
[variant] Loaded new set of variants
[kit] Successfully loaded 4 kits from C:UserslucalAppDataLocalCMakeToolscmake-tools-kits.json
[proc] Executing command: "C:Program FilesCMakebincmake.EXE" --version
[proc] Executing command: "C:Program FilesCMakebincmake.EXE" -E capabilities
[proc] Executing command: chcp
[visual-studio] Patch Windows SDK path from C:Program Files (x86)Windows Kits10binx64 to C:Program Files (x86)Windows Kits10bin10.0.22621.0x64 for C:Program FilesMicrosoft Visual Studio2022CommunityVCAuxiliaryBuildvcvarsall.bat
[main] Configuring project: NWT
[proc] Executing command: "C:Program FilesCMakebincmake.EXE" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -SC:/Users/lucal/OneDrive/Desktop/NWT -Bc:/Users/lucal/OneDrive/Desktop/NWT/build -G "Visual Studio 17 2022" -T host=x86 -A x64
[cmake] Not searching for unused variables given on the command line.
[cmake] CMake Error: The current CMakeCache.txt directory C:/Users/lucal/OneDrive/Desktop/NWT/build/CMakeCache.txt is different than the directory c:/Users/FireLuc33/OneDrive/Desktop/NWT/build where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt
[cmake] CMake Error: The source "C:/Users/lucal/OneDrive/Desktop/NWT/CMakeLists.txt" does not match the source "C:/Users/FireLuc33/OneDrive/Desktop/NWT/CMakeLists.txt" used to generate cache. Re-run cmake with a different source directory.
[proc] The command: "C:Program FilesCMakebincmake.EXE" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -SC:/Users/lucal/OneDrive/Desktop/NWT -Bc:/Users/lucal/OneDrive/Desktop/NWT/build -G "Visual Studio 17 2022" -T host=x86 -A x64 exited with code: 1
[visual-studio] Patch Windows SDK path from C:Program Files (x86)Windows Kits10binx64 to C:Program Files (x86)Windows Kits10bin10.0.22621.0x64 for C:Program FilesMicrosoft Visual Studio2022CommunityVCAuxiliaryBuildvcvarsall.bat
[proc] The command: "C:Program FilesCMakebinctest.exe" --show-only=json-v1 -j10 -C Debug -T test --output-on-failure exited with code: 12
[ctest] There was an error running ctest to determine available test executables
In my code I use Opencv and import it by using following line:
#include <opencv2/opencv.hpp>
vscode shows these two following error messages for this exact line where I implement the library:
[{
"resource": "/c:/Users/lucal/OneDrive/Desktop/NWT/src/Main.cpp",
"owner": "C/C++: IntelliSense",
"code": "1696",
"severity": 8,
"message": "#include errors detected based on information provided by the configurationProvider setting. Squiggles are disabled for this translation unit (C:\Users\lucal\OneDrive\Desktop\NWT\src\Main.cpp).",
"source": "C/C++",
"startLineNumber": 2,
"startColumn": 1,
"endLineNumber": 2,
"endColumn": 30
}]
and this:
[{
"resource": "/c:/Users/lucal/OneDrive/Desktop/NWT/src/Main.cpp",
"owner": "C/C++: IntelliSense",
"code": "1696",
"severity": 8,
"message": "cannot open source file "opencv2/opencv.hpp"",
"source": "C/C++",
"startLineNumber": 2,
"startColumn": 1,
"endLineNumber": 2,
"endColumn": 30
}]
my Cmakelists.txt file looks like this:
cmake_minimum_required(VERSION 3.10)
project(NWT)
include(ctest)
enable_testing()
set(C:/Users/lucal/OneDrive/Dokumente/libraries/opencv/build)
find_package(OpenCV REQUIRED)
add_executable(${PROJECT_NAME} src/Main.cpp)
target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS})
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
I tried to build a program that uses Opencv to detect faces and play voice lines. of all the libraries I use the only one showing an error is OpenCV. And for some reason ctest doesn#t work, I originally wrote this code on my pc, but I imported it on my laptop, I changed the file paths to match the ones on the laptop. On my Pc it works, here it doesn’t.
FireLuc33 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.