I am a python dev who is learning C++. I have a question:
I would like to install an external library libxlsxwriter
. In VS Code terminal I do:
a) I create and empty folder C:\dev. I install there vcpkg using:
`cd C:\dev`
`git clone https://github.com/Microsoft/vcpkg.git`
`.\vcpkg\bootstrap-vcpkg.bat`
b) Now when I try to download the library, I got this message:
`.\vcpkg install libxlsxwriter:x64-windows`
Computing installation plan...
The following packages will be built and installed:
libxlsxwriter[core]:x64-windows -> 0.9.4
zlib[core]:x64-windows -> 1.2.11#10
Additional packages (*) will be modified to complete this operation.
**No suitable Visual Studio instances were found**
Can you please explain to me, where is the problem? Is the problem in the settings of my VS Code? Thanks a lot.
This may be because you haven't use the command to integrate the installation in your system, which is after using the bat, inside the folder of vcpkg run (btw I'm using PowerShell)
.\vcpkg.exe integrate install
According to docs: Make installed packages available user-wide. Requires admin privileges on first use.
After this according to my readings is configuring the triplet try using:
.\vcpkg.exe help triplets
your system seems to be "x64-windows" which is mine as well.
Then you'll go to and read some of it: https://vcpkg.io/en/docs/users/triplets.html
the section of windows is important, open Environment variables and create varaibles just like the so used Path or TEMP, press New and write:
VCPKG_TARGET_ARCHITECTURE x64
VCPKG_CMAKE_SYSTEM_NAME WindowsStore
And now add to the Path variable the folder where is vcpkg.exe, heres mine: C:\src\vcpkg\
close and start the shell again, now you have the ability to cast vcpkg anywhere, just write in your shell
vcpkg
Next you need to install libraries (search takes a while),
vcpkg search
to update this list it's a github in your vcpkg folder, run:
git pull
Let's say I choose sqlite3
vcpkg search sqlite
vcpkg install sqlite3
vcpkg list
very likely that detected the triplet ("Detecting compiler hash for triplet x64-windows...") There's a detail and it's supossed that vcpkg runs on a clean environment so depending on factors the previous variables may not have been set in your system so I recommend reading a little bit about this.
From here on there's just too much information and ways of going on, I recommend CMake, see (2) in references section, used in so many places, learning about this and how libs work on C++ will make you learn a lot in very little time.
Resuming:
.\vcpkg integrate install
and add the vcpkg folder to path. I recommend (1) in list of references. Give it a read to the next things, there's an atomic header inside of C++ (yeah, is THAT level)
References
(1) Michael Forest - C++ Libraries For Beginners https://youtu.be/a5kUr-u2UNo
(2) CMake Integration - https://vcpkg.io/en/docs/users/buildsystems/cmake-integration.html
(3) Env. Variables for VCPKG - https://vcpkg.io/en/docs/users/config-environment.html
(4) C libraries you have acces already - https://cplusplus.com/reference/
(5) History of C++ - https://cplusplus.com/info/history/