Can I use vcpkg without Visual Studio? - vcpkg

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.

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)

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)

how to install vcpkg for vs code?

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

Force Cmake & Emscripten to use VS 2010 for compiling

How can I force Cmake to use Visual Studio 2010 for compiling my emscripten projects, and now VS 2015?
I keep running into an issue where cmake says it cannot find the build tools for MSBuild v140. I know it exists though, as the file path is
C:\Program Files (x86)\MSBuild\14.0\Bin
I've even tried setting the path in the Emscripten Command Prompt with
set PATH=C:\Program Files (x86)\MSBuild\14.0\Bin;%PATH%
but the issue still occurs.
If I open this solution in VS 2015, I can see that the configuration is set to Msbuild v 1.40, so I can't wrap my head around why Emscripten says it can't locate it.
The closest thing I could find is in this GitHub bug report on Emscripten.
Any suggestions?
Emscripten in Visual Studio is only supported for VS2010 AFAIK. Personally, I suggest you work with makefiles when generating from CMake. It is much more stable from my experience. The Visual Studio support for Emscripten is not working well, at least for me.
But if you still want to use VS2010, then you have to set the CMake generator to "Visual Studio 10 2010", and then specify the Emscripten toolchain file. You might have to set the CMake platform name to Emscripten, using the -A argument.
cmake.exe -G "Visual Studio 10 2010" -A Emscripten -DCMAKE_TOOLCHAIN_FILE=%EMSCRIPTEN%\cmake\Modules\Platform\Emscripten.cmake
I tried doing this, but each time I did, Emscripten would return a different path to Emscripten.cmake, and say it couldn't find it. Not sure where it was getting this new path from.
Long story short, I realized I installed the web installer for Emscripten installed. So I uninstalled that and instead went with the Full installer, and it all worked well.

How do I build boost with Visual Studio 2008 when I have multiple Visual Studio versions installed?

I know how to build boost with the latest visual studio on my machine (this question, for example)
However, I need to build the libs for Visual Studio 2008 (vc9)
I tried using toolset=vc9 but I get problems/no success.
How can I build the libs for vc9?
After I run boostrap I try running
b2 toolset=vc9
but the output is:
C:/Development/boost
50/boost_1_50_0/boost_1_50_0/tools/build/v2/build\toolset.jam:39: in
toolset.using rule vc9.init unknown in module toolset
C:/Development/boost
50/boost_1_50_0/boost_1_50_0/tools/build/v2\build-system.jam:481: in
process-explicit-toolset-requests
C:/Development/boost
50/boost_1_50_0/boost_1_50_0/tools/build/v2\build-system.jam:562: in
load
C:\Development\boost
50\boost_1_50_0\boost_1_50_0\tools\build\v2/kernel\modules.jam:283: in
import
C:\Development\boost
50\boost_1_50_0\boost_1_50_0\tools\build\v2/kernel/bootstrap.jam:142:
in boost-build
C:\Development\boost 50\boost_1_50_0\boost_1_50_0\boost-build.jam:17:
in module scope
toolset=msvc-9.0
I have VS2008-Pro and VS2010-Express installed. The default ran with VS2010. Setting toolset=msvc-9.0 caused the build to run with VS2008. Using Boost 1.51.0.
You'll need to dig into the How-To-Build-Boost documentation, and in particular see this;
but the part you need to specify a particular MSVC version is pointed to here. That suggests creating a user-config.jam, which probably would work, but I created a project-config.jam file instead.
I seem to be able to do this by running the top-level boost build (or meta build) script from different VC command lines. For example to build with VC2012, start a command line with vc 2012 vars. And for 2010, do the same. The automatically generated build scripts seem to do the right thing.
I am sure there are ways to do this by editing the build scripts myself or by setting the toolset, but I had no success with that.