I just installed Visual Studio 2012 today, and I was wondering how can you install GLUT and OpenGL on the platform?
-
5OpenGL development files are part of the default installation of Visual Studio. However several usefull third party helper libraries are missing, most importantly GLEW. You install them, like you install any other development library. – datenwolf Aug 29 '12 at 09:22
-
1When I installed Visual Studio 2012, I don't think the OpenGL development files were in there. I'll double-check, but I'm pretty sure OpenGL was not in there. I installed VS 2010 in the meantime so I can get started on my school projects. – wasabiman Aug 30 '12 at 20:06
-
3Yes, they're definitely there. Visual C++ comes with the OpenGL headers in `GL/gl.h` and ships the linker symbol library opengl32.lib – datenwolf Aug 30 '12 at 22:09
11 Answers
OpenGL should be present already - it will probably be Freeglut / GLUT that is missing.
GLUT is very dated now and not actively supported - so you should certainly be using Freeglut instead. You won't have to change your code at all, and a few additional features become available.
You'll find pre-packaged sets of files from here: http://freeglut.sourceforge.net/index.php#download If you don't see the "lib" folder, it's because you didn't download the pre-packaged set. "Martin Payne's Windows binaries" is posted at above link and works on Windows 8.1 with Visual Studio 2013 at the time of this writing.
When you download these you'll find that the Freeglut folder has three subfolders: - bin folder: this contains the dll files for runtime - include: the header files for compilation - lib: contains library files for compilation/linking
Installation instructions usually suggest moving these files into the visual studio folder and the Windows system folder: It is best to avoid doing this as it makes your project less portable, and makes it much more difficult if you ever need to change which version of the library you are using (old projects might suddenly stop working, etc.)
Instead (apologies for any inconsistencies, I'm basing these instructions on VS2010)... - put the freeglut folder somewhere else, e.g. C:\dev - Open your project in Visual Studio - Open project properties - There should be a tab for VC++ Directories, here you should add the appropriate include and lib folders, e.g.: C:\dev\freeglut\include and C:\dev\freeglut\lib - (Almost) Final step is to ensure that the opengl lib file is actually linked during compilation. Still in project properties, expand the linker menu, and open the input tab. For Additional Dependencies add opengl32.lib (you would assume that this would be linked automatically just by adding the include GL/gl.h to your project, but for some reason this doesn't seem to be the case)
At this stage your project should compile OK. To actually run it, you also need to copy the freeglut.dll files into your project folder

- 517
- 4
- 7
-
3Just wanted to add that you need to copy freeglut.dll to the Debug folder in which the .exe of your project is there. – csprajeeth Nov 05 '13 at 20:05
-
2Don't try to build glut (or freeglut) by yourself because the only consequence is a pile of linking errors crying out for OpenGL functions not found. Use the answer of Vishwanath gowda instead. – user2384994 May 20 '14 at 02:41
-
A new user, @randomize, comments that "I need to modify the application entry point to `mainCRTStartup` in the VS project properties, or an error will occur." – drs Jul 29 '14 at 14:12
-
Upvote for a solution that doesn't tell you to put stuff in VS/system directories -- I have trouble trusting people that tell you to do that :P. – Shitesh Jan 29 '17 at 07:55
This is GLUT installation instruction. Not free glut
First download this 118 KB GLUT package from Here
Extract the downloaded ZIP file and make sure you find the following
glut.h
glut32.lib
glut32.dll
If you have a 32 bits operating system, place glut32.dll to C:\Windows\System32\
, if your operating system is 64 bits, place it to 'C:\Windows\SysWOW64\' (to your system directory)
Place glut.h C:\Program Files\Microsoft Visual Studio 12\VC\include\GL\
(NOTE: 12 here refers to your VS version it may be 8 or 10)
If you do not find VC and following directories.. go on create it.
Place glut32.lib to C:\Program Files\Microsoft Visual Studio 12\VC\lib\
Now, open visual Studio and
- Under Visual C++, select Empty Project(or your already existing project)
- Go to Project -> Properties. Select 'All Configuration' from Configuration dropdown menu on top left corner
- Select Linker -> Input
- Now right click on "Additional Dependence" found on Right panel and click Edit
now type
opengl32.lib
glu32.lib
glut32.lib
(NOTE: Each .lib in new line)
That's it... You have successfully installed OpenGL.. Go on and run your program.
Same installation instructions aplies to freeglut files with the header files in the GL folder, lib in the lib folder, and dll in the System32 folder.

- 1,675
- 24
- 26
-
Thank you very much, especially the link to the GLUT binary. This answer helped me solve the linker problem that puzzled me many days. – user2384994 May 20 '14 at 02:39
-
1
-
1The binary link gives 404 now... any chance it is still online somewhere? – Gassa Dec 23 '15 at 23:27
-
2Nevermind, got a similar binary. At [GLUT homepage](https://www.opengl.org/resources/libraries/glut/), the third link from the bottom of the article is [Pre-compiled Win32 for Intel GLUT 3.7 DLLs for Windows 95 & NT](https://www.opengl.org/resources/libraries/glut/glutdlls37beta.zip), and this one is still alive. – Gassa Dec 24 '15 at 00:49
OpenGL is bundled with Visual Studio. You just need to install GLUT package (freeglut would be fine), which can be found in NuGet.
Open your solution, click TOOLS->NuGet Package Manager->Package Manager Console to open a NuGet console, type Install-Package freeglut
.
--
For VS 2013, use nupengl.core
package instead.
--
It's 2020 now. Use VCPKG.

- 170
- 2
- 12
For Microsoft Visual Studio 2017 Community GLUT installation -
Download the header, dll's and lib files fro glutdlls37beta (linked in here)
Paste glut.h in
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\{14.11.25503}\include\GL
Create the GL folder if not present already. The {thing} may differ.Paste glut.lib in
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\{14.11.25503}\lib\x64
. Paste glut32.lib inC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\{14.11.25503}\lib\x86
. The {thing} may differ.Paste glut32.dll in
C:\Windows\System32
. Paste glut.dll and glut32.dll inC:\Windows\SysWOW64
.Follow Vishwanath gowda k's answer next. Go to Project -> Properties(All Configuration option)->Linker -> Input -> Additional Dependencies->edit(down arrow on the right end) Type-> opengl32.lib glu32.lib glut32.lib Hit Ok->apply.

- 821
- 9
- 22

- 165
- 3
- 10
For an easy and appropriate way of doing this, first download a prepackaged release of freeglut from here. Then read its Readme.txt.
I copied some important parts of that package here:
... Create a folder on your PC which is readable by all users, for example “C:\Program Files\Common Files\MSVC\freeglut\” on a typical Windows system. Copy the “lib\” and “include\” folders from this zip archive to that location ... freeglut DLL can be placed in the same folder as your application...
... Open up the project properties, and select “All Configurations” (this is necessary to ensure our changes are applied for both debug and release builds). Open up the “general” section under “C/C++”, and configure the “include\” folder you created above as an “Additional Include Directory”. If you have more than one GLUT package which contains a “glut.h” file, it’s important to ensure that the freeglut include folder appears above all other GLUT include folders ... Open up the “general” section under “Linker”, and configure the “lib\” folder you created above as an “Additional Library Directory”...

- 1
- 1

- 10,338
- 4
- 70
- 81
Download the GLUT library. At first step Copy the glut32.dll and paste it in C:\Windows\System32 folder.Second step copy glut.h file and paste it in C:\Program Files\Microsoft Visual Studio\VC\include folder and third step copy glut32.lib and paste it in c:\Program Files\Microsoft Visual Studio\VC\lib folder. Now you can create visual c++ console application project and include glut.h header file then you can write code for GLUT project. If you are using 64 bit windows machine then path and glut library may be different but process is similar.

- 2,603
- 1
- 26
- 36
-
16-1: For the suggestion to add them into *system directories*. You should not be throwing things into system directories. Or the MSVC directories. You should have your own place somewhere on your drive for these things, lest you accidentally break things. – Nicol Bolas Aug 29 '12 at 11:54
-
@NicolBolas I am also begineer in GLUT/OpenGL. I have setup GLUT same as above method. If we save these thing in our own drive then does we have to do linker setting and how? – Dinesh Subedi Aug 29 '12 at 12:28
-
4You tell your tools where to find your stuff, instead of putting your stuff in the tool directories. – Nicol Bolas Aug 29 '12 at 12:30
-
@NicolBolas how do you tell your tools where to find the library? – caleb.breckon Nov 13 '12 at 20:35
-
@caleb.breckon: That's what include paths and library paths are for. You can set them within a project, or you can set global defaults for all projects using VS. – Nicol Bolas Nov 13 '12 at 20:37
-
@NicolBolas is it considered a bad idea to set global defaults? as in is it a problem (overhead, annoyingly long autofill list, etc) if openGL is defined in a project that openGL is not needed in? I guess just wondering if the industry standard is to include the libraries for each projects or just set them up for everything in their compiler – caleb.breckon Nov 13 '12 at 21:32
-
@caleb.breckon: You're not including libraries for every project. You're adding include paths for every project or globally. It doesn't do anything until you actually attempt to include a header or the library itself. – Nicol Bolas Nov 13 '12 at 21:57
Yes visual studio 2012 express has built in opengl library. the headers are in the folder C:\Program Files\Windows Kits\8.0\Include\um\gl and the lib files are in folder C:\Program Files\Windows Kits\8.0\Lib\win8\um\x86 & C:\Program Files\Windows Kits\8.0\Lib\win8\um\x64. but the problem is integrating the glut with the existing one.. i downloaded the library from http://www.xmission.com/~nate/glut/glut-3.7.6-bin.zip.. and deployed the files into .....\gl and ....\lib\win8\um\x32 and the dll to %system%/windows folders respectively.. Hope so this will solve the problem...

- 29
- 6
Download and install Visual C++ Express.
Download and extract "freeglut 2.8.0 MSVC Package" from http://www.transmissionzero.co.uk/software/freeglut-devel/
Installation for Windows 32 bit:
(a) Copy all files from include/GL folder and paste into C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include\gl folder.
(b) Copy all files from lib folder and paste into C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib folder.
(c) Copy freeglut.dll and paste into C:\windows\system32 folder.

- 39,603
- 20
- 94
- 123

- 1,568
- 1
- 18
- 28
Use NupenGL Nuget package. It is actively updated and works with VS 2013 and 2015, whereas Freeglut Nuget package works with earlier versions of Visual Studio only (as of 10/14/2015).
Also, follow this blog post for easy instructions on working with OpenGL and Glut in VS.

- 96
- 1
- 6
the instructions for Vs2012
To Install FreeGLUT
- Download "freeglut 2.8.1 MSVC Package" from http://www.transmissionzero.co.uk/software/freeglut-devel/
Extract the compressed file freeglut-MSVC.zip to a folder freeglut
Inside freeglut folder:
On 32bit versions of windows
copy all files in include/GL folder to C:\Program Files\Windows Kits\8.0\Include\um\gl
copy all files in lib folder to C:\Program Files\Windows Kits\8.0\Lib\win8\um\ (note: Lib\freeglut.lib in a folder goes into x86)
copy freeglut.dll to C:\windows\system32
On 64bit versions of windows:(not 100% sure but try)
copy all files in include/GL folder to C:\Program Files(x86)\Windows Kits\8.0\Include\um\gl
copy all files in lib folder to C:\Program Files(x86)\Windows Kits\8.0\Lib\win8\um\ (note: Lib\freeglut.lib in a folder goes into x86)
copy freeglut.dll to C:\windows\SysWOW64
- Create a empty win32 console application c++
- Download a package called NupenGL Core from Nuget package manager (PM->"Install-Package nupengl.core") except glm everything is configured
- create Source.cpp and start working Happy Coding

- 21
- 2