DEV Community

dinhanhx
dinhanhx

Posted on

4 2

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

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs