I’m trying to compile a program using cmake that uses opencv-contrib to use WeChat QRCode in C++ in VSCode on Windows 11.
I need:
#include <chrono>
#include <iostream>
#include <opencv2/opencv.hpp>
#include <opencv2/wechat_qrcode.hpp>
I executed the commands:
make -B .\build\
cmake -DOPENCV_EXTRA_MODULES_PATH='C:\opencv_contrib-4.8.0\modules' -B .\build\
Correct.
However, when I run the command:
cmake --build .\build\ the following error appears:
wechatQRcodeReader.cpp
C:\Users\Avell\Documents\We_Chat_QRCode1\wechatQRcodeReader.cpp(5,10): fatal error C1083: Cannot open file include: 'opencv2/wechat_qrcode.hpp': No such file or directory [C:\Users\Avell\Documents\We_Chat_QRCode1
\build\wechatQRcodeReader.vcxproj]
My CmakeLists.txt:
cmake_minimum_required(VERSION 3.0.0)
project(wechatQRcodeReader VERSION 0.1.0)
include(CTest)
enable_testing()
find_package(OpenCV REQUIRED)
find_package(Threads REQUIRED)
add_executable(wechatQRcodeReader wechatQRcodeReader.cpp)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX__STANDARD_REQUIRED ON)
include_directories(${OpenCV_INCLUDE_DIRS})
target_link_libraries(wechatQRcodeReader ${OpenCV_LIBS} ${CMAKE_THREAD_LIBS_INIT})
Where am I going wrong?