Tagged: 

Viewing 2 reply threads
  • Author
    Posts
    • #4693 Score: 0
      v4vendeta
      Participant

      用的是vcpkg+vscode
      但是在编译的时候会报错找不到eigen和opencv

    • #4695 Score: 0
      v4vendeta
      Participant

      此外在运行cmake. 的时候会出现如下错误
      [main] Configuring folder: 代码框架
      [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 -Hd:/onedrive/Program/cg/GamesCG/homework/Assignment1/代码框架 -Bd:/onedrive/Program/cg/GamesCG/homework/Assignment1/代码框架/build -G Ninja
      [cmake] Not searching for unused variables given on the command line.
      [cmake] CMake Error at CMakeLists.txt:4 (find_package):
      [cmake] By not providing “FindOpenCV.cmake” in CMAKE_MODULE_PATH this project has
      [cmake] asked CMake to find a package configuration file provided by “OpenCV”, but
      [cmake] CMake did not find one.
      [cmake]
      [cmake] Could not find a package configuration file provided by “OpenCV” with any
      [cmake] of the following names:
      [cmake]
      [cmake] OpenCVConfig.cmake
      [cmake] opencv-config.cmake
      [cmake]
      [cmake] Add the installation prefix of “OpenCV” to CMAKE_PREFIX_PATH or set
      [cmake] “OpenCV_DIR” to a directory containing one of the above files. If “OpenCV”
      [cmake] provides a separate development package or SDK, be sure it has been
      [cmake] installed.
      [cmake]
      [cmake]
      [cmake] — Configuring incomplete, errors occurred!
      [cmake] See also “D:/onedrive/Program/cg/GamesCG/homework/Assignment1/代码框架/build/CMakeFiles/CMakeOutput.log”.

    • #17034 Score: 0
      JiaFeiMiao
      Participant

      setting toolchain file in visual studio code and cmake tool for vsc doesn’t work

      根据StackOverflow上这个问题的评论区修改CMakeLists.txt,实测有效

      cmake_minimum_required(VERSION 3.20)
      set(CMAKE_TOOLCHAIN_FILE "C:/vcpkg/scripts/buildsystems/vcpkg.cmake")
      project(Rasterizer)
      
      find_package(OpenCV REQUIRED)
      
      set(CMAKE_CXX_STANDARD 17)
      
      include_directories(/usr/local/include)
      
      add_executable(Rasterizer main.cpp rasterizer.hpp rasterizer.cpp Triangle.hpp Triangle.cpp)
      target_link_libraries(Rasterizer ${OpenCV_LIBRARIES})
Viewing 2 reply threads
  • You must be logged in to reply to this topic.