Table of Contents
This updated guide examines How to Set up Opengl‐glfw‐glad on a Project with Visual Studio and organizes the essential facts, background, and practical takeaways in clear American English.
Method 1
Downloading GLFW and GLAD
Highlight what you expect to do. For example see picture above.- Create folder GL . In directory (disk) C:, right click > select New > Folder > type GL > hit↵Enter.
- In folder GL create folder with name glad .
- Download GLFW. Right click on following address and select Open Link in New Window https://www.glfw.org/download.html, click32-bit Windows binaries. You get "glfw-3.3.bin. WIN32" or latest version.
- Click it > right click > select Copy.
- Navigate to C: > GL > right click > select paste.
- Click on "glfw-3.3.bin. WIN32" and rename to glfw .
- Now in "GL" folder you have two folders: glad and glfw .
Download GLAD. Right click on following address and select Open Link in New Window https://glad.dav1d.de/. In Language leave C/C++ . In API/gl entry, select the latest version (today is 4.6). In Specification leave OpenGL . In Profile select Core . Scroll down the page and clickGENERATE.
- In the "Glad" window, click "glad.zip", (see picture above).
- After download, in downloading window you have two zip folders: include and src .
- Click folder include > right click > Copy .
- Navigate to C: > GL > glad. In glad folder right click > select Paste .
- (Alternatively click folder include and drag into folder glad , at C:GLglad).
- Go back to downloading window > click folder src > right click > Copy .
- Navigate to C: > GL > glad. In glad folder right click > select Paste .
- (Alternatively click folder src and drag into folder glad , at C:GLglad).
- Now in folder glad you have two (unzipped) folders: include and src .
Method 2
Creating a Visual Studio Project
- Create an empty project.
- With Visual Studio 2017
- In V. S. main menu, click File. Then go to New > Project…
- In the left part of the new project window, click Visual C++ if it is not clicked.
- In the center of the screen click Empty Project .
- Below that, find the Name text box, type Project-0 .
- Next to Location text box, click Browse... and navigate to C: > GL. Folder' s name should be GL .
- Click Select a folder . The Location in New Project window is C:GL.
- Make sure the Create directory for solution box is not checked.
- ClickOK.
- With Visual Studio 2019
- If it's not opened . Open it > ClickCreate a new project>Empty Project>Next.
- In "Project name" text field type: Project-0 . Next to "Location" text field click....
- Navigate to C: > GL. Folder' s name should be GL . ClickSelect folder. Now "Location" is C:GL .
- Check "Place solution and project in the same directory" > clickCreate.
- Wait till Visual Studio 2019 instance appears.
- If it's opened . Click File > New > Project… >Empty Project>Next. The rest as above.
- With Visual Studio 2017
- Add your source file to the Project.
- In the "Solution Explorer" window, right click the Source Files entry (the last one).
- Click Add > New Item… In the Add New Item - Project-0 wizard, click C++ File (.cpp) (the first one) from the middle of the window. In the Name text box leave Source.cpp .
- The Location is C:GLProject-0.
- Click theAddbutton. The file will open in the main text editor but leave the file blank for now.
Method 3
Installing GLFW and GLAD in the Project
- Add file glad.c . Go to Visual Studio > Solution Explorer > right click Source Files > click Add > Existing Item... .
- Navigate to C: > GL > glad > src > glad.c > click glad.c . "File name" should be glad.c . ClickAdd.
Configure Project-0 Property Pages . In Solution Explorer, right click on the name of your project, that is Project-0 , and select Properties . Select Configuration: Active(Debug), Platform: Active(Win32).
- (1) Additional Include Directories . Open C/C++ drop-down menu. Click General > Additional Include Directories. > the down arrow at the right of the field > click in the drop down menu.
- Copy C:GLglfwinclude > in Additional Include Directories wizard click first icon > paste.
. - Copy C:GLgladinclude > in Additional Include Directories wizard click first icon > paste.
- On Additional Include Directories wizard clickOK.
- Copy C:GLglfwinclude > in Additional Include Directories wizard click first icon > paste.
- (2) Additional Library Directories . Open the Linker drop-down menu, and click General . Click Additional Library Directories entry > down arrow at the right of the field > click in the drop-down menu.
- In "Additional Library Directories" wizard click first icon >....
- Navigate to C: > GL > glfw > lib-vc2019 or the latest. In the "Select Directory" window, the "Folder" should be "lib-vc2019" or the latest. ClickSelect folder.
- In "Additional Library Directories," clickOK.
- (3) Additional Dependencies . In Linker drop down menu click "Input". Click Additional Dependencies entry > the down arrow at the right of the field > in the drop-down menu.
- Copy opengl32.lib; glfw3.lib; glfw3dll.lib and paste on the top-most text box of the Additional Dependencies wizard. ClickOKin the Additional Dependencies wizard.
- (4) Set Linker "SubSystem" to "Console" . In the Linker drop-down menu, click System > SubSystem > click the down arrow at the end of the field > select Console(/SUBSYSTEM:CONSOLE) from the dropdown menu > clickApply, thenOKon the Project Property Pages wizard.
- (1) Additional Include Directories . Open C/C++ drop-down menu. Click General > Additional Include Directories. > the down arrow at the right of the field > click in the drop down menu.
- Test your project. Right click on following address and select Open Link in New Window https://learnopengl.com/code_viewer_gh.php?code=src/1.getting_started/2.1.hello_triangle/hello_triangle.cpp Copy the code. Go to Visual Studio and paste in Source.cpp code area > hitCtr+F5, and wait... Two windows should appear: One black and other with name "LearnOpenGL" and inside an orange triangle.
- If only the black window (the console) appears with message: "Failed to create GLFW window", set up is okay, function glfwCreateWindow did not work.
- Correct any errors. In "Error List" if you see error about
- file with extension.h go to part (Method) 3, step 1, "Configure the "Additional Include Directories"" and follow instructions.
- file with extension.lib go to part (Method) 3, step 2, "Configure the linker "Additional Library Directories"", and follow instructions. Also to step 3, "Configure the linker "Additional Library Directories"".
- "entry point must be defined" go to step 4, Set linker "SubSystem" to "CONSOLE" and follow instructions.
- file glad.c go to step 5, and follow instructions.
- For other errors, if you cannot correct them, close Visual Studio > delete project folder Project-0 which lives in C:GL > open Visual Studio > repeat set up from part Method 2 . Good job.
Method 4
Creating a Project with an OpenGL-GLFW-GLAD Template
- Create Template. Go to Visual Studio main menu and, while Project-0 is open , click Project > Export Template... . On Export template Wizard check Project Template , if it's not checked. ClickNext >. On Select Template Options , in Template name text box type: OpenGL-GLFW-GLAD . ClickFinish. The Template has been created.
- Create Project.
- With V. S. 2017 . Click File > New > Project... .
- On the New Project window, click template: OpenGL-GLFW-GLAD .
- In Name text field, type: Project-1 .
- Location should be C:GL. If it's not, clickBrowse> navigate C:GL > Folder' s name should be GL > clickSelect a folder.
- Be sure Create directory for solution is unchecked. ClickOK.
- With V. S. 2019 . Click File > New > Project... .
- In Create a new project wizard scroll down the list of templates and select OpenGL-GLFW-GLAD > clickNext.
- In Configure your new project wizard, in "Project name" text field type Project-1 .
- Location should be C:GL. If it's not, click...> navigate C:GL > Folder' s name should be GL > clickSelect a folder.
- Be sure Place solution and project in the same directory is checked. ClickCreate.
- Type or paste a new code in Source.cpp. Run the program. Good job.
- With V. S. 2017 . Click File > New > Project... .
Method 5
Creating Project to target x64 Platform
- Download GLFW. Right click on following address and select Open Link in New Window https://www.glfw.org/download.html, click64-bit Windows binaries. You get "glfw-3.3.bin. WIN64" or latest version. The rest as above but with following step.
- Project's Property Pages main settings. Go to "Solution Explorer" > right click on the name of your project > select "Properties". In Platform: entry, choose x64 > ClickConfiguration manager...
- In Active solution platform: select x64
- In Platform entry, x64 is automatically selected.
- ClickClose
- Tip: Even if in Property Pages main settings it is Platform: x64, clickConfiguration manager...and in Active solution platform: select x64.
- Create template. As above.
- TIP: In every project you create with it, select x64 (next to Debug) in Visual Studio's GUI.
Method 6
Setting up GLFW built by CMake, and GLAD
- Build GLFW by CMake and Visual Studio, and set up in project. Right click on following link and select Open Link in New Window Use CMake to Get Binaries from Source Code. Follow it, but...
- Before Method 3 ( Testing Binaries ), download GLAD according to present article's Method 1, step 4.
- In Method 3 ( Testing Binaries ), after step 2, add glad.c file: Go to Visual Studio > Solution Explorer > right click Source Files > click Add > Existing Item... .
- Navigate to C: > GL > glad > src > glad.c > click glad.c . "File name" should be glad.c . ClickAdd.
- In Solution Explorer , below Source Files you should see two files: glad.c and Main.cpp .
- In same Method (3), in step 3 Configure project's Properties , sub-step (2) Additional Include Directories , after configuring C:GLglfwinclude, copy C:GLgladinclude and, in Additional Include Directories wizard, click first icon > paste > clickOK.
- Test your project and correct errors if any . In present article follow Method 3, steps 3 and 4.
- Create template. As above.
- TIP: In every project you create with it, select x64 (next to Debug) in Visual Studio's GUI.
Method 7
Choosing Set Up
- In this tutorial you learn 3 was to set up GLFW and GLAD in Project with Visual Studio.
- Set up binaries x86 (32 bits). It's the easiest. You should start learning set up from here.
- Set up binaries x64 (64 bits). It targets x64 platform. Choose it only when you have specific reason for doing so.
- Compile GLFW source, and set up, together with GLAD, in project. Targets x64 too. The most difficult. The best though.
Frequently Asked Questions
What is How to Set up Opengl‐glfw‐glad on a Project with Visual Studio about?
It provides a structured overview of click, explains the main context, and highlights practical takeaways for readers.
Why does this topic matter?
Understanding the main concepts helps readers evaluate the issue, avoid common mistakes, and make better-informed decisions.
How should readers use this information?
Use the guidance as a practical starting point, confirm details that may have changed, and follow current product, safety, or security recommendations.
Was this article helpful?
Your feedback helps us improve.
Reader Comments 0
Sign in with email or Google to join the discussion.