Home:ALL Converter>vcpkg and cmake and vsc on Ubuntu can not find package

vcpkg and cmake and vsc on Ubuntu can not find package

Ask Time:2021-07-30T05:47:33         Author:mans

Json Formatter

I installed vcpkg on Ubuntu 20.04 and install boost and opencv.

I have this cmakelist file:

set(CMAKE_TOOLCHAIN_FILE /home/m/local/vcpkg/scripts/buildsystems/vcpkg.cmake CACHE STRING "")
set(VCPKG_TARGET_TRIPLET "x64-linux" CACHE STRING "")
cmake_minimum_required(VERSION 3.0.0)
project(test1 VERSION 0.1.0)
    
find_package(Opencv CONFIG REQUIRED)
find_package(boost CONFIG REQUIRED )
    
add_executable(test1 main.cpp)
target_link_libraries(test1 PRIVATE opencv::opencv boost::boost)

but when I run it inside Visual studio code, it can not find openCV and boost.

What is the problem and how can I solve it?

Author:mans,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/68583134/vcpkg-and-cmake-and-vsc-on-ubuntu-can-not-find-package
yy