how to install vcpkg for vs code? - c++

I tried to install vcpkg for VS code and in a PowerShell Window. I had this error:
Could not find MSBuild version with C ++ support. VS2015, VS2017 or VS2019 (with C ++) must be installed.
So I installed Visual studio and I have the same error. What should I do?

Run vcpkg integrate install to customize Visual Studio Code on Linux or macOS. This command sets the location of the vcpkg enum and enables IntelliSense for the source files.
Look at this web page: https://learn.microsoft.com/ru-ru/cpp/build/vcpkg?view=msvc-160#integrate-with-visual-studio-code-linuxmacos

Related

gRPC compiling error with Clang/Visual Studio

For a C++ project, I need to use gRPC. everything went well with MSVC143 compiler, And I did.
but I'm using Clang compiler in Visual Studio 2022. So, it must build by Clang.
I tired to do this, but, I'm getting too many errors at the compile time.
Here, you can see them:
I did the whole instructions according to this tutorial. As I've said before. It works very well when I choose MSVC as compiler.
It's pretty weird. What should I do?
Future Information:
Visual Studio 2022(it's the latest version).
Clang version 13.0.1(it's the latest version as well).
CMake version 3.24.1(it's the latest version as well).
This article says These steps require. I did them as well.
Windows To prepare for cmake + Microsoft Visual C++ compiler build
Install Visual Studio 2015 or 2017 (Visual C++ compiler will be used).
Install Git. Install CMake. Install Active State Perl (choco install
activeperl) - required by boringssl Install Go (choco install golang)
required by boringssl Install yasm and add it to PATH (choco install yasm) - required by boringssl (Optional) Install Ninja (choco install
ninja)

Can I use vcpkg without Visual Studio?

I just downloaded and configured vcpkg. But when I tried to install a package, I got this error message:
error: in triplet x64-windows: Unable to find a valid Visual Studio instance
Could not locate a complete Visual Studio instance
Does it mean it is necessary to install Visual Studio to make the vcpkg available?
Considering that all my work is doing on clion and vscode, if it's necessary, what's the minimum required components should I install?
Or maybe it's just my wrong somewhere?
No, you do not need to install Visual Studio to use vcpkg. By default, vcpkg tries to build packages with the MSVC compiler if you are on Windows. You could install just the Visual Studio Build Tools, which would give you MSVC without installing the entire IDE, if you wish.
What compiler are you currently using?
If you happen to be using MinGW, you should tell vcpkg to use that. See: https://vcpkg.io/en/docs/users/mingw.html.
Disclaimer: I work on the vcpkg tool.

Installing boost via vcpkg, I get the wrong toolset

I recently switched from using the Visual Studio 2015 IDE to the Visual Studio 2019 IDE. Around that same time I started using vcpkg for library installations. I've been using a pre-build version of an earlier version of boost, which I compiled myself. Thinking I ought to switch to a newer version of boost using vcpkg, I installed it with:
vcpkg.exe install boost --triplet x64-windows-static
Yet when I look inside C:\dev\vcpkg\installed\x64-windows-static\lib I see that vc140 - the Visual Studio 2015 toolset - is the version of boost built. Note that I am not using cmake. I am working purely in the IDE. How do I tell vcpkg I want the vc142 toolset, the version for Visual Studio 2019, built?
The answer is a modified version of the GitHub issues,
Edit file from your VCPKG path
vcpkg\triplets\x86-windows.cmake
To add line
set(VCPKG_PLATFORM_TOOLSET v142)

Visual Studio 2019 x64 app using mongocxx driver

I'm trying to get a windows x64 C++ project working with the latest mongocxx driver using Visual Studio 2019. I installed the driver libraries using vcpkg:
vcpkg install mongo-cxx-driver[boost]
In VS 2019 I created a new console app and inserted the example code from the mongo driver page into main(). I built the app and ran it; everything works great. Then I noticed that it built as a win 32 app and switched it over to x64. Now the project won't build b/c it can't find the header files. Specifically (1rst error only...the others are similar)
Severity Code Description Project File Line Suppression State
Error C1083 Cannot open include file: 'bsoncxx/json.hpp': No such file or directory
What do I need to do to make it work on the x64 platform?
As I suspected, it was something I just didn't know to do. From Neumann-A on the vcpkg github site:
vcpkg install mongo-cxx-driver[boost]:x64-windows
or
vcpkg install mongo-cxx-driver[boost] --triplet x64-windows
or
set VCPKG_DEFAULT_TRIPLET=x64-windows
vcpkg install mongo-cxx-driver[boost]

MSB8008: Specified platform toolset <v120> is not installed or invalid error without installing VS2013

I am trying to build the C++ dlls with Msbuild from command prompt. But it was throwing the error as:
MS8008: Specified platform toolset is not installed or invalid.
I could see in some answers its been mentioned as issue will be resolved if VS2013 is installed in the machines, but Im trying to run in a build server where we shouldn't install visual studio. I have installed Microsoft Build Tools 2013 and 2015 even then the issue is resolved. Please help me if any configuration changes required or any other software's needs to be installed to build C++ dll with msbuild.