DEV Community

dinhanhx
dinhanhx

Posted on

The way you should install C++ libraries and install Visual Studio on Windows 10

In this tutorial, I will show you the way to install Visual Studio as small as minimum as possible.

Install Visual Studio

Download Visual Studio Installer

When in Visual Studio Installer GUI windows, I suggest you tick like this

image

It will consume your diskspace at most 4gb.

Install vcpkg

vcpkg is a cross-platform C++ libraries manager. It will do the hard work for you such as building, importing, setting up PATHS, ..etc.

How to install vcpkg

To install vcpkg

> git clone https://github.com/microsoft/vcpkg
> .\vcpkg\bootstrap-vcpkg.bat
Enter fullscreen mode Exit fullscreen mode

To install the libraries for your project, run:

> .\vcpkg\vcpkg install [packages to install]
Enter fullscreen mode Exit fullscreen mode

You can also search for the libraries you need with the search subcommand:

> .\vcpkg\vcpkg search [search term]
Enter fullscreen mode Exit fullscreen mode

In order to use vcpkg with Visual Studio,
run the following command (may require administrator elevation):

> .\vcpkg\vcpkg integrate install
Enter fullscreen mode Exit fullscreen mode

All installed libraries are immediately ready to be #include'd and used in your project without additional configuration.

Example

I want to setup glut, glew, glm for my Computer Graphics course.

I go to where my vcpkg is installed. Then I run

vcpkg.exe install freeglut glew glm
Enter fullscreen mode Exit fullscreen mode

I wait until it is done.

vcpkg.exe integrate install
Enter fullscreen mode Exit fullscreen mode

Top comments (0)