OpenGL Libraries

Sid Kraft 46 Reputation points
2026-06-28T13:28:13.1166667+00:00

New user for Visual Studio and trying to set up the system for OpenGL Functions use. It was suggested to

-open the Developer Power Shell to execute the vcpkg software to set up the libraries. Not exactly sure how to do and do I execute this module in my current project or a new one? Please let me know, Sid kraft

Developer technologies | C++
Developer technologies | C++

A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Nancy Vo (WICLOUD CORPORATION) 6,595 Reputation points Microsoft External Staff Moderator
    2026-06-29T03:30:30.4466667+00:00

    Hello @Sid Kraft ,

    Thanks for your question.

    You do not need to execute this module inside a specific project. vcpkg operates globally, meaning once you set it up, the libraries will be available for all your current and future Visual Studio projects.

    You can refer to following steps:

    1. Open the Developer PowerShell.

    You can open this directly inside Visual Studio. Go to the top menu bar and select:

    • View > Terminal.
    • Alternatively, you can navigate to Tools > Command Line > Developer PowerShell.
    1. Install OpenGL.

    In the PowerShell window, type the following command and press Enter:

    vcpkg install opengl.

    Note: This might take a few minutes as your system downloads and builds the required files.

    1. Link the Libraries to Visual Studio.

    Once the installation finishes, type the following command and press Enter:

    vcpkg integrate install.

    This command tells Visual Studio where to find your new tools. After it successfully runs, you will be able to start using OpenGL functions in any of your C++ projects.

    For more details on how package management works, you can refer to the official documentation on vcpkg documentation.

    I hope this addresses your question. If this response was helpful, please consider following the guidance to provide feedback.

    Was this answer helpful?

    0 comments No comments

  2. AI answer

    2026-06-28T13:28:29.0166667+00:00

    To use OpenGL libraries in Visual Studio via vcpkg, set up vcpkg once on the machine, then use it from your projects. It is not tied to a single project.

    1. Set up vcpkg

    1. Open any terminal (you can use the Developer PowerShell in Visual Studio).
    2. Clone the vcpkg repo:
         git clone https://github.com/microsoft/vcpkg.git
      
    3. Run the bootstrap script to build vcpkg:
         cd vcpkg; .\bootstrap-vcpkg.bat
      
      After this, vcpkg.exe is ready to use.
    4. Integrate vcpkg with Visual Studio MSBuild (user-wide):
         .\vcpkg.exe integrate install
      
      This makes MSBuild aware of vcpkg’s installation path so C++ projects can automatically use installed libraries.

    2. Configure environment for Developer PowerShell

    In Visual Studio, open Developer PowerShell (View → Terminal or the Developer PowerShell entry), then run:

    $env:VCPKG_ROOT = "C:\path\to\vcpkg"
    $env:PATH = "$env:VCPKG_ROOT;$env:PATH"
    

    Use the actual path where vcpkg was cloned. This lets the shell find vcpkg.exe easily.

    These commands affect only the current terminal session. To make them permanent, set VCPKG_ROOT and update PATH in the Windows System Environment Variables panel.

    3. Use vcpkg with a Visual Studio project

    You can run vcpkg commands from the Developer PowerShell in the folder of the project that needs OpenGL (for example, a console C++ app or a graphics project). Typical workflow:

    1. Create a new C++ project (for example, Console Application) in Visual Studio.
    2. In Developer PowerShell, change directory to the project folder.
    3. Initialize vcpkg manifest mode in that project:
         vcpkg new --application
      
      This creates vcpkg.json and vcpkg-configuration.json in the project directory.
    4. Add dependencies (for OpenGL-related libraries, you would add the appropriate ports; the example below shows adding fmt):
         vcpkg add port fmt
      
      The manifest will look like:
         {
             "dependencies": [
                 "fmt"
             ]
         }
      
      For OpenGL, use the relevant ports instead of fmt.
    5. In Visual Studio, open Project → Properties → Configuration Properties → vcpkg and set Use vcpkg Manifest to Yes.

    After this, building the project will cause vcpkg to install the listed dependencies and MSBuild will automatically handle include paths and linking. You do not need a separate “vcpkg project”; vcpkg is configured once and then used from each project that has a vcpkg.json manifest.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.