cmake_minimum_required(VERSION 3.29)
project(opencv_app)
# Enable C++17
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Enable vcpkg manifest mode
if(DEFINED ENV{VCPKG_ROOT})
set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
CACHE STRING "")
# Set a suitable triplet for Linux (adjust if using a different architecture)
set(VCPKG_TARGET_TRIPLET "x64-linux" CACHE STRING "")
endif()
message(STATUS "Using vcpkg toolchain file: ${CMAKE_TOOLCHAIN_FILE}")
message(STATUS "Using vcpkg triplet: ${VCPKG_TARGET_TRIPLET}")
# Add executable
add_executable(opencv_app main.cpp)
# Find OpenCV package via vcpkg
find_package(OpenCV REQUIRED)
target_link_libraries(opencv_app PRIVATE ${OpenCV_LIBS})
target_include_directories(opencv_app PRIVATE ${OpenCV_INCLUDE_DIRS})
< /code>
und vcpkg.json: < /p>
{
"name": "opencv_app",
"version": "0.1.0",
"dependencies": [
{
"name": "opencv",
"default-features": false,
"features": [ "jpeg" ]
}
]
}
< /code>
Und ich versuche es mit diesem Befehl zu erstellen: < /p>
cmake -B build -S .
< /code>
, aber ich erhalte diesen Fehler: < /p>
cmake -B build -S .
-- The C compiler identification is GNU 13.3.0
-- The CXX compiler identification is GNU 13.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using vcpkg toolchain file: /media/r/Data/locals/vcpkg/scripts/buildsystems/vcpkg.cmake
-- Using vcpkg triplet: x64-linux
CMake Error at CMakeLists.txt:24 (find_package):
By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "OpenCV", but
CMake did not find one.
Could not find a package configuration file provided by "OpenCV" with any
of the following names:
OpenCVConfig.cmake
opencv-config.cmake
Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
"OpenCV_DIR" to a directory containing one of the above files. If "OpenCV"
provides a separate development package or SDK, be sure it has been
installed.
-- Configuring incomplete, errors occurred!
Ich habe diese Dateien, die versuchen, eine einfache Anwendung mit OpenCV unter Linux zu erstellen: < /p> [code]cmake_minimum_required(VERSION 3.29) project(opencv_app)
# Find OpenCV package via vcpkg find_package(OpenCV REQUIRED) target_link_libraries(opencv_app PRIVATE ${OpenCV_LIBS}) target_include_directories(opencv_app PRIVATE ${OpenCV_INCLUDE_DIRS}) < /code> und vcpkg.json: < /p> { "name": "opencv_app", "version": "0.1.0", "dependencies": [ { "name": "opencv", "default-features": false, "features": [ "jpeg" ] } ] } < /code> Und ich versuche es mit diesem Befehl zu erstellen: < /p> cmake -B build -S . < /code> , aber ich erhalte diesen Fehler: < /p> cmake -B build -S . -- The C compiler identification is GNU 13.3.0 -- The CXX compiler identification is GNU 13.3.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Using vcpkg toolchain file: /media/r/Data/locals/vcpkg/scripts/buildsystems/vcpkg.cmake -- Using vcpkg triplet: x64-linux CMake Error at CMakeLists.txt:24 (find_package): By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "OpenCV", but CMake did not find one.
Could not find a package configuration file provided by "OpenCV" with any of the following names:
OpenCVConfig.cmake opencv-config.cmake
Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set "OpenCV_DIR" to a directory containing one of the above files. If "OpenCV" provides a separate development package or SDK, be sure it has been installed.
-- Configuring incomplete, errors occurred! [/code] Was ist das [url=viewtopic.php?t=26065]Problem[/url] und wie ich es beheben kann?>
Ich habe diese Dateien, die versuchen, eine einfache Anwendung mit OpenCV unter Linux zu erstellen:
cmake_minimum_required(VERSION 3.29)
project(opencv_app)
Nachdem Sie das vcpkg-Tutorial mit cmake befolgt haben. Cmake konnte „MinGW Makefiles“ mit vcpkg nicht erkennen.
Einige Informationen zu meinem System
Ich verwende Windows x64 Bit und habe mingw...
Ich versuche, ein C ++ - Projekt mit einer späteren Version der Protobuf -Bibliotheken zu erstellen, als mein OS -Paket -Manager. (In diesem Fall nur protobuf und sonst nichts.)
Ich habe das...
Ich habe es geschafft, ein minimales Arbeitsbeispiel für ein C ++ - Projekt zu erstellen, das den VCPKG Paket -Manager mit CMAKE verwendet. Dies ist keine skalierbare Lösung. (Oder zumindest eine...
Ich habe Schwierigkeiten bei der Installation von dlib 19.24.0 für Stable Diffusion. Ich habe Python 3.10.11 installiert. Beim Starten der automatischen 1111-Web-Benutzeroberfläche schlägt die...