Einige Informationen zu meinem System
Ich verwende Windows x64 Bit und habe mingw heruntergeladen von winlibs und fügte es zum „PFAD“ hinzu, und cmake (Version 3.31.3) wurde von der offiziellen Website als ZIP-Datei heruntergeladen, ebenfalls zum „PFAD“ hinzugefügt und vcpkg mit Hilfe des Tutorials hinzugefügt „VCPKG_ROOT“ und sein Pfad als Umgebungsvariable, und noch einmal im „PATH“.
helloworld dir:
- < li>vcpkg.json:
Code: Select all
{
"dependencies": [
"fmt"
]
}
- Cmakelists.txt
Code: Select all
cmake_minimum_required(VERSION 3.10)
project(HelloWorld)
find_package(fmt CONFIG REQUIRED)
add_executable(HelloWorld helloworld.cpp)
target_link_libraries(HelloWorld PRIVATE fmt::fmt)
- vcpkg-configuration.json
Code: Select all
{
"default-registry": {
"kind": "git",
"baseline": "80d54ff62d528339c626a6fbc3489a7f25956ade",
"repository": "https://github.com/microsoft/vcpkg"
},
"registries": [
{
"kind": "artifact",
"location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip",
"name": "microsoft"
}
]
}
- helloworld.cpp
Code: Select all
#include
int main()
{
fmt::print("Hello World!\n");
return 0;
}
- CMakePresets.json
Code: Select all
{
"version": 2,
"configurePresets": [
{
"name": "vcpkg",
"generator": "MinGW Makefiles",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
}
}
]
}
- CMakeUserPresets.json
Code: Select all
{
"version": 2,
"configurePresets": [
{
"name": "default",
"inherits": "vcpkg",
"environment": {
"VCPKG_ROOT": "C:/vcpkg"
}
}
]
}
Nachdem das alles im Verzeichnis helloworld abgelegt wurde. Ich habe den Befehl „cmake --preset=default“ im Halloworld-Verzeichnis verwendet und er hat diesen Fehler ausgegeben:
Code: Select all
Preset CMake variables:
CMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake"
Preset environment variables:
VCPKG_ROOT="C:/vcpkg"
-- Running vcpkg install
Fetching registry information from https://github.com/microsoft/vcpkg (HEAD)...
error: in triplet x64-windows: Unable to find a valid Visual Studio instance
Could not locate a complete Visual Studio instance
-- Running vcpkg install - failed
CMake Error at C:/vcpkg/scripts/buildsystems/vcpkg.cmake:904 (message):
vcpkg install failed. See logs for more information:
C:/helloworld/build/vcpkg-manifest-install.log
Call Stack (most recent call first):
C:/cmake/share/cmake-3.31/Modules/CMakeDetermineSystem.cmake:146 (include)
CMakeLists.txt:3 (project)
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
Ich glaube also nicht, dass es in meinem „PATH“ ein Problem darstellt ", oder eine beliebige Umgebungsvariable auf meinem System.
Code: Select all