Search code examples
linuxopenglg++glut

glut already installed, still not compiling


I am compiling a program using the following command:

g++ main.cpp -o run -lglut -lm

And getting the following error:

main.cpp:20:21: fatal error: GL\glut.h: No such file or directory
 #include <GL\glut.h>
                     ^
compilation terminated.

Although glut is already installed: apt-get install freeglut3 freeglut3-dev

Reading package lists... Done
Building dependency tree       
Reading state information... Done
freeglut3 is already the newest version.
freeglut3-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 367 not upgraded.

Any !dea...


Solution

  • The backslash '\' is not a valid path separator character on linux. You have to use a slash '/'. Note that windows also supports that notation, so that this will work cross-platform.