Open BiliBiliFox opened 7 months ago
However, a prevalent challenge surfaces when working within Visual Studio
Number 1 answer here is: a) Use CMake. If you used CMake to generate project files you did something wrong with the triplet selection, ran cmake in an already configured folder or simply forgot to link the target otherwise b) Make sure Visual Studio actually uses that triplet (see the vcpkg property in the property viewer)
c) system includes should use <>
instead of ""
d) packages
is the staging directory. The correct path is (vcpkg_)?installed/....
e) Consider setting VCPKG_DEFAULT_HOST_TRIPLET
instead
I mainly see this as an user error. You probably will also fail to use one of the single config triplets like x64-windows-release.
When utilizing the gtest library with vcpkg, the standard installation command is quite verbose:
To streamline this process, I've implemented some enhancements. Initially, I added the
VCPKG_DEFAULT_TRIPLET
environment variable to the system and set it asx64-win-llvm
, which obviates the need to include--triplet=x64-win-llvm
in the command. Subsequently, I established theVCPKG_OVERLAY_TRIPLETS
environment variable, directing it toD:\dev\project\3\my-vcpkg-triplets
, thereby eliminating the requirement for--overlay-triplets=D:\dev\project\3\my-vcpkg-triplets
. Following these adjustments, you can conveniently install the library with justvcpkg install gtest
. However, a prevalent challenge surfaces when working within Visual Studio. Preprocessor directives such as#include "gtest/gtest.h"
may trigger errors. This discrepancy arises because the library files, generated by vcpkg, are situated in paths likeD:\vcpkg\packages\gtest_x64-win-llvm
, whereas the customary library path isD:\vcpkg\packages\gtest_x64-windows
. It appears there's an issue with the imported library directory. @Neumann-A How can we address this problem?