我不能包括通过vcpkg安装的第三方库。
我在用
使用C/C++、CMake和CMake工具插件的
10
C:\Users\Jaiel>g++ --version
g++ (GCC) 10.2.0C:\Users\Jaiel>vcpkg version
Vcpkg package management program version 2021-05-05-9f849c4c43e50d1b16186ae76681c27b0c1be9d9C:\Users\Jaiel>cmake --version
cmake version 3.20.3我在试着做些测试项目来做游戏。
我试过:
都失败了。
下面我将概述一下我对sqlite3的尝试:
Installation
C:\Users\Jaiel>vcpkg install sqlite3
Computing installation plan...
The following packages will be built and installed:
sqlite3[core]:x86-windows -> 3.35.4#1
Detecting compiler hash for triplet x86-windows...
A suitable version of powershell-core was not found (required v7.1.0). Downloading portable powershell-core v7.1.0...
Downloading powershell-core...
https://github.com/PowerShell/PowerShell/releases/download/v7.1.3/PowerShell-7.1.3-win-x86.zip -> C:\vcpkg\downloads\PowerShell-7.1.3-win-x86.zip
Extracting powershell-core...
A suitable version of 7zip was not found (required v18.1.0). Downloading portable 7zip v18.1.0...
Downloading 7zip...
https://www.nuget.org/api/v2/package/7-Zip.CommandLine/18.1.0 -> C:\vcpkg\downloads\7-zip.commandline.18.1.0.nupkg
Extracting 7zip...
A suitable version of nuget was not found (required v5.5.0). Downloading portable nuget v5.5.0...
Downloading nuget...
https://dist.nuget.org/win-x86-commandline/v5.5.1/nuget.exe -> C:\vcpkg\downloads\22ea847d-nuget.exe
Using cached binary package: C:\Users\Jaiel\AppData\Local\vcpkg\archives\65\6548fa5df73dbc6b768ef43fa0e5da4ca39334d4.zip
Starting package 1/1: sqlite3:x86-windows
Building package sqlite3[core]:x86-windows...
Building package sqlite3[core]:x86-windows... done
Installing package sqlite3[core]:x86-windows...
Installing package sqlite3[core]:x86-windows... done
Elapsed time for package sqlite3:x86-windows: 27.67 ms
Total elapsed time: 2.061 min
The package sqlite3:x86-windows provides CMake targets:
find_package(unofficial-sqlite3 CONFIG REQUIRED)
target_link_libraries(main PRIVATE unofficial::sqlite3::sqlite3)
C:\Users\Jaiel>vcpkg integrate install
Applied user-wide integration for this vcpkg root.
All MSBuild C++ projects can now #include any installed libraries.
Linking will be handled automatically.
Installing new libraries will make them instantly available.
CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake"tutorial.cxx
#include <sqlite3.h>
#include <stdio.h>
int main()
{
printf("%s\n", sqlite3_libversion());
return 0;
}CMakeLists.txt
# CMakeLists.txt
cmake_minimum_required(VERSION 3.0)
project(test)
find_package(unofficial-sqlite3 CONFIG REQUIRED)
add_executable(test tutorial.cxx)
target_link_libraries(test PRIVATE unofficial::sqlite3::sqlite3)CMake输出
[main] Building folder: test
[main] Configuring folder: test
[proc] Executing command: "C:\Program Files\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_C_COMPILER:FILEPATH=C:\cygwin64\bin\x86_64-pc-cygwin-gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\cygwin64\bin\x86_64-pc-cygwin-g++.exe -Hc:/Users/Jaiel/Desktop/test -Bc:/Users/Jaiel/Desktop/test/build -G "Unix Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake] CMake Error at C:/vcpkg/scripts/buildsystems/vcpkg.cmake:772 (_find_package):
[cmake] Could not find a package configuration file provided by
[cmake] "unofficial-sqlite3" with any of the following names:
[cmake]
[cmake] unofficial-sqlite3Config.cmake
[cmake] unofficial-sqlite3-config.cmake
[cmake]
[cmake] Add the installation prefix of "unofficial-sqlite3" to CMAKE_PREFIX_PATH or
[cmake] set "unofficial-sqlite3_DIR" to a directory containing one of the above
[cmake] files. If "unofficial-sqlite3" provides a separate development package or
[cmake] SDK, be sure it has been installed.
[cmake] Call Stack (most recent call first):
[cmake] CMakeLists.txt:5 (find_package)
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "C:/Users/Jaiel/Desktop/test/build/CMakeFiles/CMakeOutput.log".它根本没有与上述三种方法中的任何一种一起工作。wxwidgets给了我一个不同的错误,它有一些丢失的LIBS和包含路径,但无论如何,它没有工作,无论我谷歌多少。
有人能帮我吗?
发布于 2022-11-05 07:01:54
提示之一是确保在安装x64 vcpkg依赖项时使用x64-windows调用cmake。
x86-windows的想法也是一样。
https://stackoverflow.com/questions/67793665
复制相似问题