Prepare your computer for OPENGL/GLAD programming (C++)

This is a tutorial based on the technologies required for the related courses of (x64, windows setup):

  • OPENGL 3.3
  • GLFW
  • GLAD
  • SOIL
  • freetype
  • irrKlang
  • VS Studio community (latest version)

Summary of what you are going to install:

  • VS 2019 (or the most recent)
  • learnopengl GIT repository

Step 1 – Prerequisites:

Check you have the latest drivers for your graphics card installed and that you can run OPENGL applications.

Step 2 – Install CMAKE

Download and install 64-bit cmake installer (windows/x64/msi) from the official site

The .msi file is an installer so you don’t have to do anything complicated.

Step 3 – Install VS C++ 2019 community

Download and install VS 2019 community for C++ from the official site

Step 4 – Clone the repository (link)

Clone or download the repository from github. Extract the files to any directory you want. For the current example to:


Step 5 – Build the examples with CMAKE

From a terminal (or from windows run dialog – winkey+R), execute the command:


The cmake form will appear. You should fill the fields so that the source directory is the one where you extracted the repository on the previous step and the binaries directory to be the subdirectory dist or build within that directory. For example:

Then press the button generate and wait until compilation finishes.

Step 6 – Create an C++ project

Create an empty C++ project with VS and select the project and the solution to be in the same directory.

Then create a main.cpp and test that you can compile C++ programs.

Step 7 – Copy the headers and the lib files

copy the following directories from the repository to your project:

  • includes
  • lib

Then copy the following files from the repository src subdirectory to your project:

  • glad.c

Step 8 – Configure the project

At this point you have to configure for the project:

  • additional include directories (directory: includes)
  • additional library directories (directory: lib)
  • additional dependencies (opengl32.lib; glfw3.lib;assimp.lib)

Right click on the project. Select properties. Then make sure you have selected: all configurations // all platforms:

Screenshots are given below:

For the dependencies you can add to specifically x64 platform. You can ignore the x86 configuration completely.

You should add the following prefix (add the others as needed):


Step 9 – Configure preprocessor directives

Add the following directives:


Step 10 – Add the source files and libraries

Add the following files to the project (from the context menu):

  • glad.c

Step 11 – Test the environment

Replace the contents of your main.cpp with the contents of the hello_triangle.cpp (example 2.1) from the repository.

Compile and run the project. The program should report runtime DLL error.

Step 12 – Add the DLLS

Copy the DDLS found in the directory dll of the repository to the directory that was created during the compilation from VS. For example copy:

  • assimp-vc140-mt.dll
  • ikpMP3.dll
  • irrKlang.dll


<project directory>/x64/Debug/

Step 13 – Run the project

At this point the project should be ready.


“TextureFromFile” cannot be found

Add the preprocessor flag: STB_IMAGE_IMPLEMENTATION to project properties:

“TextureFromFile” already defined

Open learnopengl/model.h and mark the function: TextureFromFile as inline

Make sure only one file includes : <learnopengl/model.h>

CANNOT OPEN “root_directory.h”

Delete the line that cases the error and replace logl_root with “.” (at FileSystem class)

‘getenv’: This function or variable is unsafe

Add the preprocessor flag: _CRT_SECURE_NO_WARNINGS to project properties:

Unresolved external symbol _gladLoadGLLoader

Your should use the x64 configuration. Not the x86:

Unresolved external symbol gladloadglloader

Add glad.c to the project source files.

ASSIMP-vc-140mt.ddl not found

Copy the dll files from the repository to the directory where the executable was generated.

Leave a Reply