gpt4 book ai didi

c++ - 尝试在 Windows 10 中通过 cmake 在 Visual Studio Code 中使用 vcpkg 安装 SDL2

转载 作者:行者123 更新时间:2023-12-02 10:27:14 26 4
gpt4 key购买 nike

已经尝试了两天我可以谷歌的一切。这是 CMakeLists.txt:

cmake_minimum_required(VERSION 3.0.0)
project(main VERSION 0.1.0)
set(CMAKE_TOOLCHAIN_FILE "C:/vcpkg/scripts/buildsystems/vcpkg.cmake")

include(CTest)
enable_testing()

find_package(SDL2 CONFIG REQUIRED)

add_executable(main main.cpp)

set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
target_link_libraries(main PRIVATE SDL2::SDL2 SDL2::SDL2main)
这是输出:
[main] Building folder: Example 
[main] Configuring folder: Example
[proc] Executing command: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" --no-warn-unused-cli -DCMAKE_TOOLCHAIN_FILE:STRING=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug "-DCMAKE_C_COMPILER:FILEPATH=C:\Program Files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin\gcc.exe" "-DCMAKE_CXX_COMPILER:FILEPATH=C:\Program Files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin\g++.exe" -Hc:/Users/tausciam/Desktop/Programming/Example -Bc:/Users/tausciam/Desktop/Programming/Example/build -G "MinGW Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake] CMake Error at C:/vcpkg/installed/x64-windows/share/sdl2/vcpkg-cmake-wrapper.cmake:1 (_find_package):
[rollbar] Unhandled exception: Unhandled exception: Processing "data" event from proc stderr TypeError: message must be set {"data":{"type":"Buffer","data":[67,77,97,107,101,32,69,114,114,111,114,32,97,116,32,67,58,47,118,99,112,107,103,47,105,110,115,116,97,108,108,101,100,47,120,54,52,45,119,105,110,100,111,119,115,47,115,104,97,114,101,47,115,100,108,50,47,118,99,112,107,103,45,99,109,97,107,101,45,119,114,97,112,112,101,114,46,99,109,97,107,101,58,49,32,40,95,102,105,110,100,95,112,97,99,107,97,103,101,41,58,10,32,32,67,111,117,108,100,32,110,111,116,32,102,105,110,100,32,97,32,99,111,110,102,105,103,117,114,97,116,105,111,110,32,102,105,108,101,32,102,111,114,32,112,97,99,107,97,103,101,32,34,83,68,76,50,34,32,116,104,97,116,32,105,115,32,99,111,109,112,97,116,105,98,108,101,10,32,32,119,105,116,104,32,114,101,113,117,101,115,116,101,100,32,118,101,114,115,105,111,110,32,34,34,46,10,10,32,32,84,104,101,32,102,111,108,108,111,119,105,110,103,32,99,111,110,102,105,103,117,114,97,116,105,111,110,32,102,105,108,101,115,32,119,101,114,101,32,99,111,110,115,105,100,101,114,101,100,32,98,117,116,32,110,111,116,32,97,99,99,101,112,116,101,100,58,10,10,32,32,32,32,67,58,47,118,99,112,107,103,47,105,110,115,116,97,108,108,101,100,47,120,54,52,45,119,105,110,100,111,119,115,47,115,104,97,114,101,47,115,100,108,50,47,83,68,76,50,67,111,110,102,105,103,46,99,109,97,107,101,44,32,118,101,114,115,105,111,110,58,32,50,46,48,46,49,50,32,40,54,52,98,105,116,41,10,10]},"command":"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\CMake\\bin\\cmake.exe","args":["--no-warn-unused-cli","-DCMAKE_TOOLCHAIN_FILE:STRING=C:/vcpkg/scripts/buildsystems/vcpkg.cmake","-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE","-DCMAKE_BUILD_TYPE:STRING=Debug","-DCMAKE_C_COMPILER:FILEPATH=C:\\Program Files (x86)\\mingw-w64\\i686-8.1.0-posix-dwarf-rt_v6-rev0\\mingw32\\bin\\gcc.exe","-DCMAKE_CXX_COMPILER:FILEPATH=C:\\Program Files (x86)\\mingw-w64\\i686-8.1.0-posix-dwarf-rt_v6-rev0\\mingw32\\bin\\g++.exe","-Hc:/Users/tausciam/Desktop/Programming/Example","-Bc:/Users/tausciam/Desktop/Programming/Example/build","-G","MinGW Makefiles"]}
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "C:/Users/tausciam/Desktop/Programming/Example/build/CMakeFiles/CMakeOutput.log".
[cmake] CMake Error at C:/vcpkg/installed/x64-windows/share/sdl2/vcpkg-cmake-wrapper.cmake:1 (_find_package):Call Stack (most recent call first):
[rollbar] Unhandled exception: Unhandled exception: Processing "data" event from proc stderr TypeError: message must be set {"data":{"type":"Buffer","data":[67,97,108,108,32,83,116,97,99,107,32,40,109,111,115,116,32,114,101,99,101,110,116,32,99,97,108,108,32,102,105,114,115,116,41,58,10,32,32,67,58,47,118,99,112,107,103,47,115,99,114,105,112,116,115,47,98,117,105,108,100,115,121,115,116,101,109,115,47,118,99,112,107,103,46,99,109,97,107,101,58,52,52,52,32,40,105,110,99,108,117,100,101,41,10,32,32,67,77,97,107,101,76,105,115,116,115,46,116,120,116,58,56,32,40,102,105,110,100,95,112,97,99,107,97,103,101,41,10,10,10]},"command":"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\CMake\\bin\\cmake.exe","args":["--no-warn-unused-cli","-DCMAKE_TOOLCHAIN_FILE:STRING=C:/vcpkg/scripts/buildsystems/vcpkg.cmake","-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE","-DCMAKE_BUILD_TYPE:STRING=Debug","-DCMAKE_C_COMPILER:FILEPATH=C:\\Program Files (x86)\\mingw-w64\\i686-8.1.0-posix-dwarf-rt_v6-rev0\\mingw32\\bin\\gcc.exe","-DCMAKE_CXX_COMPILER:FILEPATH=C:\\Program Files (x86)\\mingw-w64\\i686-8.1.0-posix-dwarf-rt_v6-rev0\\mingw32\\bin\\g++.exe","-Hc:/Users/tausciam/Desktop/Programming/Example","-Bc:/Users/tausciam/Desktop/Programming/Example/build","-G","MinGW Makefiles"]}
[cmake] CMake Error at C:/vcpkg/installed/x64-windows/share/sdl2/vcpkg-cmake-wrapper.cmake:1 (_find_package):Call Stack (most recent call first):
[rollbar] Unhandled exception: Unhandled exception: Resolving process on "close" event TypeError: message must be set {"line_acc":"","stderr_line_acc":"CMake Error at C:/vcpkg/installed/x64-windows/share/sdl2/vcpkg-cmake-wrapper.cmake:1 (_find_package):Call Stack (most recent call first):","command":"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\CMake\\bin\\cmake.exe","retc":1}
[ctest] There was an error running ctest to determine available test executables
我确实运行了 .\vcpkg 集成安装,并且该库似乎确实可以在带有 MSBUILD 的 Visual Studio 2019 中工作。

最佳答案

我相信您看到的无用错误消息与您的 CMake 配置的实际问题无关。
有一个开放的,最近的问题 herehere .
请尝试运行 cmake .在终端的构建目录中,以便在 VS 代码之外进行配置。这可能会为您提供更有用的错误消息。

关于c++ - 尝试在 Windows 10 中通过 cmake 在 Visual Studio Code 中使用 vcpkg 安装 SDL2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63856161/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com