I was doing some OpenGL programming in C++.
This is part of my code:
#include <time.h> #include <windows.h> #include <gl/gl.h> #include <gl/glu.h> #include <gl/glut.h> <<< Error here "Cannot open source file gl/glut.h"
How can I fix this?
EDIT: I am using Microsoft Visual C++ Express Edition. Sorry forgot to mention it
You probably haven't installed GLUT:
Source: http://cacs.usc.edu/education/cs596/OGL_Setup.pdf
EDIT:
The quickest way is to download the latest header, and compiled DLLs for it, place it in your system32 folder or reference it in your project. Version 3.7 (latest as of this post) is here: http://www.opengl.org/resources/libraries/glut/glutdlls37beta.zip
Folder references: glut.h: 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\GL\' glut32.lib: 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\' glut32.dll: 'C:\Windows\System32\' For 64-bit machines, you will want to do this. glut32.dll: 'C:\Windows\SysWOW64\' Same pattern applies to freeglut and GLEW files with the header files in the GL folder, lib in the lib folder, and dll in the System32 (and SysWOW64) folder. 1. Under Visual C++, select Empty Project. 2. Go to Project -> Properties. Select Linker -> Input then add the following to the Additional Dependencies field: opengl32.lib glu32.lib glut32.lib
Reprinted from here
If you are using Visual Studio Community 2015 and trying to Install GLUT you should place the header file glut.h
in C:\Program Files (x86)\Windows Kits\8.1\Include\um\gl
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With