I am using VS Code and I want to compile C++ code that use wxWidgets3.2 via cmake.
I installed:
mingw-w64-x86_64-gcc
mingw-w64-x86_64-cmake
mingw-w64-x86_64-wxwidgets3.2-msw
During cmake configure i got this following error:
[variant] Loaded new set of variants
[kit] Successfully loaded 2 kits from C:\Users\walkiewi\AppData\Local\CMakeTools\cmake-tools-kits.json
[proc] Executing command: C:\msys64\mingw64\bin\gcc.exe -v
[main] Configuring folder: jcp
[proc] Executing command: C:\msys64\mingw64\bin\cmake.EXE --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=C:\msys64\mingw64\bin\gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\msys64\mingw64\bin\g++.exe -Sc:/Users/walkiewi/Documents/projects/jcp -Bc:/Users/walkiewi/Documents/projects/jcp/build -G "MinGW Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake] CMake Error at C:/msys64/mingw64/share/cmake/Modules/FindwxWidgets.cmake:225 (message):
[cmake] wxWidgets wx/version.h file not found in C:/Program;C:/Program.
[cmake] Call Stack (most recent call first):
[cmake] C:/msys64/mingw64/share/cmake/Modules/FindwxWidgets.cmake:955 (wx_extract_version)
[cmake] CMakeLists.txt:12 (find_package)
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "C:/Users/walkiewi/Documents/projects/jcp/build/CMakeFiles/CMakeOutput.log".
[proc] The command: C:\msys64\mingw64\bin\cmake.EXE --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=C:\msys64\mingw64\bin\gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\msys64\mingw64\bin\g++.exe -Sc:/Users/walkiewi/Documents/projects/jcp -Bc:/Users/walkiewi/Documents/projects/jcp/build -G "MinGW Makefiles" exited with code: 1 and signal: null
I tried changing two lines in FindwxWidgets.cmake
from
if(WIN32 AND NOT CYGWIN AND NOT MSYS AND AND NOT CMAKE_CROSSCOMPILING)
if(wxWidgets_FOUND AND MSYS)
to:
if(WIN32 AND NOT CYGWIN AND NOT MSYS AND NOT MINGW AND NOT CMAKE_CROSSCOMPILING)
if(wxWidgets_FOUND AND (MSYS OR MINGW))
But the error is still present
Related
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
Hello I'm trying to get a C++ project to run with cmake but when building I always get an error on this line:
find_package(jsoncpp REQUIRED)
the error being:
[cmake] CMake Error at src/scouting/CMakeLists.txt:12 (find_package):
[cmake] Could not find a configuration file for package "jsoncpp" that is
[cmake] compatible with requested version "".
[cmake]
[cmake] The following configuration files were considered but not accepted:
[cmake]
[cmake] /home/moritz/Schreibtisch/DA/airclipObstacleDetection/lib/jsoncpp/build/jsoncppConfig.cmake, version: 1.9.2 (64bit)
I realized it says requested version "" so I changed the line to:
find_package(jsoncpp 1.9.2 REQUIRED)
now the error is:
[cmake] CMake Error at src/scouting/CMakeLists.txt:12 (find_package):
[cmake] Could not find a configuration file for package "jsoncpp" that is
[cmake] compatible with requested version "1.9.2".
[cmake]
[cmake] The following configuration files were considered but not accepted:
[cmake]
[cmake] /home/moritz/Schreibtisch/DA/airclipObstacleDetection/lib/jsoncpp/build/jsoncppConfig.cmake, version: 1.9.2 (64bit)
How is 1.9.2 not compatible with exactly 1.9.2? I guess the "(64bit)" is the key? but I can't add that into find_package, right?
I am trying to use OpenCV in VS Code.
Here's what I've done:
Installed OpenCV for windows.
Added "C:\opencv\build\x64\vc15\bin","C:\opencv\build\x64\vc15\lib" PATH environment variable.
Here's my CMakeLists.txt file.
cmake_minimum_required(VERSION 3.0.0)
project(opencvtest VERSION 0.1.0)
include(CTest)
enable_testing()
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
add_executable(opencvtest main.cpp)
target_link_libraries( opencvtest ${OpenCV_LIBS} )
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
But the file throws the following error:
[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:\TDM-GCC-64\bin\x86_64-w64-mingw32-gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\TDM-GCC-64\bin\x86_64-w64-mingw32-g++.exe -Hc:/Users/Administrator/Desktop/open -Bc:/Users/Administrator/Desktop/open/build -G "MinGW Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake] -- OpenCV ARCH: x64
[cmake] -- OpenCV RUNTIME: mingw
[cmake] -- OpenCV STATIC: OFF
[cmake] CMake Warning at C:/opencv/build/OpenCVConfig.cmake:190 (message):
[cmake] Found OpenCV Windows Pack but it has no binaries compatible with your
[cmake] configuration.
[cmake]
[cmake] You should manually point CMake variable OpenCV_DIR to your build of OpenCV
[cmake] library.
[cmake] Call Stack (most recent call first):
[cmake] CMakeLists.txt:7 (find_package)
[cmake]
[cmake]
[cmake] CMake Error at CMakeLists.txt:7 (find_package):
[cmake] Found package configuration file:
[cmake]
[cmake] C:/opencv/build/OpenCVConfig.cmake
[cmake]
[cmake] but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be
[cmake] NOT FOUND.
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
I am trying to run a C++ file in VS Code that includes <opencv2/opencv.hpp>.
As the error suggests, CMake found your OpenCV installation, but it is not compatible. What is it not compatible with? Your compiler. The OpenCV installation is built with MSVC 15 (it also includes a 14 build). You have asked CMake to use MinGW as your compiler. Libraries need to have been built with the same (well, with some leeway) compiler for everything to work.
You have two options:
Build OpenCV yourself with MinGW, or try a third-party MinGW binary distribution of OpenCV. Web searches for "opencv mingw" turn up some
possibilities.
Use the MSVC compiler for your project. Microsoft offers some free versions of its tools. Just be sure to install the optional older toolsets so that you have access to the VC 15 tools to match OpenCV.
I am using vs code and CMake to generator the yuzu project, but the CMakeList.txt always report error on the conan code since line 127 ,and I have already install the conan in the CMD with pip command.
Yuzu project and the CMakeList.txt
CMake output
[proc] run command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli "-Dcmake.cmakePath:STRING=C:/Program Files/CMake/bin/cmake" -Dcmake.configureOnOpen:BOOL=TRUE "-Dcmake.generator:STRING=MinGW Makefiles" -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -He:/Visual_Studio_Code/yuzu_emulator/yuzu -Be:/Visual_Studio_Code/yuzu_emulator/yuzu/build -G "Visual Studio 16 2019" -T host=x86 -A win32
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Target architecture: x86
[cmake] -- Could NOT find Boost (missing: Boost_INCLUDE_DIR) (Required is at least version "1.71")
[cmake] -- Could NOT find Catch2 (missing: Catch2_INCLUDE_DIR Catch2_VERSION) (Required is at least version "2.11")
[cmake] -- Could NOT find fmt (missing: fmt_LIBRARY fmt_INCLUDE_DIR fmt_VERSION) (Required is at least version "6.2")
[cmake] -- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR) (Required is at least version "1.1")
[cmake] -- Could NOT find lz4 (missing: lz4_LIBRARY lz4_INCLUDE_DIR) (Required is at least version "1.8")
[cmake] -- Could NOT find nlohmann_json (missing: nlohmann_json_INCLUDE_DIR nlohmann_json_VERSION) (Required is at least version "3.7")
[cmake] -- Could NOT find opus (missing: opus_LIBRARY opus_INCLUDE_DIR) (Required is at least version "1.3")
[cmake] -- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) (Required is at least version "1.2")
[cmake] -- Could NOT find zstd (missing: zstd_LIBRARY zstd_INCLUDE_DIR zstd_VERSION) (Required is at least version "1.4")
[cmake] CMake Warning at CMakeLists.txt:217 (find_package):
[cmake] By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project has
[cmake] asked CMake to find a package configuration file provided by "Qt5", but
[cmake] CMake did not find one.
[cmake]
[cmake] Could not find a package configuration file provided by "Qt5" (requested
[cmake] version 5.9) with any of the following names:
[cmake]
[cmake] Qt5Config.cmake
[cmake] qt5-config.cmake
[cmake]
[cmake] Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"
[cmake] to a directory containing one of the above files. If "Qt5" provides a
[cmake] separate development package or SDK, be sure it has been installed.
[cmake]
[cmake]
[cmake] CMake Warning at CMakeLists.txt:229 (find_package):
[cmake] By not providing "FindSDL2.cmake" in CMAKE_MODULE_PATH this project has
[cmake] asked CMake to find a package configuration file provided by "SDL2", but
[cmake] CMake did not find one.
[cmake]
[cmake] Could not find a package configuration file provided by "SDL2" with any of
[cmake] the following names:
[cmake]
[cmake] SDL2Config.cmake
[cmake] sdl2-config.cmake
[cmake]
[cmake] Add the installation prefix of "SDL2" to CMAKE_PREFIX_PATH or set
[cmake] "SDL2_DIR" to a directory containing one of the above files. If "SDL2"
[cmake] provides a separate development package or SDK, be sure it has been
[cmake] installed.
[cmake]
[cmake]
[cmake] -- Packages boost/1.72.0;catch2/2.11.0;fmt/6.2.0;openssl/1.1.1f;lz4/1.9.2;nlohmann_json/3.7.3;opus/1.3.1;zlib/1.2.11;zstd/1.4.4;qt/5.14.1#bincrafters/stable;sdl2/2.0.12#bincrafters/stable not found!
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "E:/Visual_Studio_Code/yuzu_emulator/yuzu/build/CMakeFiles/CMakeOutput.log".
[cmake] See also "E:/Visual_Studio_Code/yuzu_emulator/yuzu/build/CMakeFiles/CMakeError.log".
[cmake] CMake Error at CMakeLists.txt:252 (conan_check):
[cmake] Unknown CMake command "conan_check".
generally its a problem that the CMakeList.txt file can't run the code about the conan and the lib can't be auto download, but how can i sovle the porblem, bro??????The project do not offer the conan.cmake. im a web developer,not familiar with the c++ proj construct.
The CMakeLists.txt of the yuzu repository (found at the parent directory) requires version 1.24.0 of conan, while the latest is 1.25.2. I assume you have installed the latest version.
Change line 252 from:
conan_check(VERSION 1.24.0 REQUIRED)
to:
conan_check(VERSION 1.25.2 REQUIRED)
and it should work.
Do not forget to delete the cmake cache in your build folder.
I just found out about Openbr and started to install required libraries like OpenCV and QT. I followed these instructions for windows(win10 64bit):
http://openbiometrics.org/docs/install/#windows
but unfortionatly got stuck when executing the following command:
cmake -G "NMake Makefiles" -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DWITH_FFMPEG=OFF -DCMAKE_BUILD_TYPE=Debug ..
with this output:
CMake Error at C:/opencv-2.4.11/build-msvc2013/win-install/OpenCVConfig.cmake:71 (include):
include could not find load file:
C:/opencv-2.4.11/build-msvc2013/win-install/OpenCVModules.cmake
Call Stack (most recent call first):
CMakeLists.txt:87 (find_package)
-- adding C:/openbr/openbr/plugins/classification
-- adding C:/openbr/openbr/plugins/cluster
-- adding C:/openbr/openbr/plugins/cmake
-- adding C:/openbr/openbr/plugins/core
-- importing C:/openbr/openbr/plugins/cuda/module.cmake
-- adding C:/openbr/openbr/plugins/distance
-- adding C:/openbr/openbr/plugins/format
-- adding C:/openbr/openbr/plugins/gallery
-- adding C:/openbr/openbr/plugins/gui
-- adding C:/openbr/openbr/plugins/imgproc
-- adding C:/openbr/openbr/plugins/io
-- adding C:/openbr/openbr/plugins/metadata
-- adding C:/openbr/openbr/plugins/output
-- adding C:/openbr/openbr/plugins/representation
-- adding C:/openbr/openbr/plugins/video
CMake Error at openbr/CMakeLists.txt:52 (add_subdirectory):
The source directory
C:/openbr/openbr/janus
does not contain a CMakeLists.txt file.
CMake Warning at C:/Program Files/CMake/share/cmake-3.6/Modules /InstallRequiredSystemLibraries.cmake:463 (message):
system runtime library file does not exist:
'MSVC12_REDIST_DIR-NOTFOUND/x64/Microsoft.VC120.CRT/msvcp120.dll'
Call Stack (most recent call first):
share/openbr/cmake/InstallDependencies.cmake:135 (include)
openbr/CMakeLists.txt:67 (install_compiler_libraries)
CMake Warning at C:/Program Files/CMake/share/cmake-3.6/Modules/InstallRequiredSystemLibraries.cmake:463 (message):
system runtime library file does not exist:
'MSVC12_REDIST_DIR-NOTFOUND/x64/Microsoft.VC120.CRT/msvcr120.dll'
Call Stack (most recent call first):
share/openbr/cmake/InstallDependencies.cmake:135 (include)
openbr/CMakeLists.txt:67 (install_compiler_libraries)
-- Configuring incomplete, errors occurred!
See also "C:/openbr/build-msvc2013/CMakeFiles/CMakeOutput.log".