"error: GL/gl.h: No such file or directory" even tough I have it installed (debian)

Hi there,

I’m trying to compile a project, but I receive the following error:


In file included from monitor/gfx/field.h:14,
                 from monitor/gfx/termapi.h:18,
                 from monitor/gfx/termapi.cpp:16:
monitor/gfx/glfont.h:8:31: error: GL/gl.h: No such file or directory
monitor/gfx/glfont.h:9:33: error: GL/glu.h: No such file or directory
monitor/gfx/termapi.cpp:20:30: error: GL/glx.h: No such file or directory

I include like this:


#include <GL/gl.h> 
#include <GL/glu.h> 
#include <GL/glx.h>

I have the following installed:
freeglut3-dev
libglu1-mesa-dev
libglu1-xorg-dev

I do compile with “-lglut -lGL -lGLU”. I’ve tried to also add “-Iusr/include” but then I instead get:


In file included from /usr/include/features.h:388,
                 from /home/poltech/CodeSourcery/Sourcery_G++_Lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/include/c++/4.3.3/arm-none-linux-gnueabi/bits/os_defines.h:44,
                 from /home/poltech/CodeSourcery/Sourcery_G++_Lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/include/c++/4.3.3/arm-none-linux-gnueabi/bits/c++config.h:40,
                 from /home/poltech/CodeSourcery/Sourcery_G++_Lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/include/c++/4.3.3/cstring:48,
                 from cfg/group_cfg.cpp:13:
/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory

And if I instead add “-Iusr/include/GL”, and change the includes from <GL/gl.h> to “<gl.h>” I get:


In file included from monitor/gfx/glfont.h:8,
                 from monitor/gfx/field.h:14,
                 from monitor/gfx/termapi.h:18,
                 from monitor/display.cpp:23:
/usr/include/GL/gl.h:2085:22: error: GL/glext.h: No such file or directory
In file included from monitor/gfx/glfont.h:9,
                 from monitor/gfx/field.h:14,
                 from monitor/gfx/termapi.h:18,
                 from monitor/display.cpp:23:
/usr/include/GL/glu.h:38:19: error: GL/gl.h: No such file or directory

I don’t know what to do to get pass this. Can anyone help me?

[QUOTE=ssssssara;1259428]I include like this:


#include <GL/gl.h> 
#include <GL/glu.h> 
#include <GL/glx.h>

I have the following installed:
freeglut3-dev
libglu1-mesa-dev
libglu1-xorg-dev[/quote]

This is all fine. Do this:

ls -l /usr/include/GL

This will show you what GL files you have installed. /usr/include is searched by default by the compiler, which is why <GL/gl.h> is what you put in source files.

I do compile with “-lglut -lGL -lGLU”. I’ve tried to also add “-Iusr/include” but then I instead get:

You’re missing a leading slash on /usr/include. Also, you should not have to add this is an include path because the compiler uses this by default. Now you can make it “not” search this path by adding the -nostdinc arg to the compiler, but you probably don’t want to do that.

First, verify that gl.h and glext.h exist in /usr/include/GL. If so, then let’s see the full command you are using to invoke the compiler. Also, is this the compiler that was built/installed on your system by default, or did you build a custom compiler (gcc)?

# ls -l /usr/include/GL
total 1964
-rw-r--r-- 1 root root   7830 Jul 14  2012 freeglut_ext.h
-rw-r--r-- 1 root root    681 Jul 14  2012 freeglut.h
-rw-r--r-- 1 root root  26152 Jul 14  2012 freeglut_std.h
-rw-r--r-- 1 root root 837247 Feb 13  2012 glew.h
-rw-r--r-- 1 root root 656589 Jun  5  2013 glext.h
-rw-r--r-- 1 root root  84468 Jun  5  2013 gl.h
-rw-r--r-- 1 root root 128943 Jun  5  2013 gl_mangle.h
-rw-r--r-- 1 root root  17255 Jun  5  2013 glu.h
-rw-r--r-- 1 root root   3315 Jun  5  2013 glu_mangle.h
-rw-r--r-- 1 root root    639 Jul 14  2012 glut.h
-rw-r--r-- 1 root root  62741 Feb 13  2012 glxew.h
-rw-r--r-- 1 root root  43887 Jun  5  2013 glxext.h
-rw-r--r-- 1 root root  17170 Jun  5  2013 glx.h
-rw-r--r-- 1 root root   3463 Jun  5  2013 glx_mangle.h
drwxr-xr-x 2 root root   4096 May  9 10:28 internal
-rw-r--r-- 1 root root  59403 Feb 13  2012 wglew.h

arm-none-linux-gnueabi-g++ -c -DDEBUG  -DIPROM_1_50 -DMONITOR -DNO_LEDMODULES -DOSLO_SUBWAY -DVIA -DDYNAMIC_GW  -Wall -g -O `pkg-config libxml++-2.6 --cflags` `sdl-config --cflags` monitor/display.cpp -o monitor/display.o  `pkg-config libxml++-2.6 --cflags --libs` `sdl-config --cflags --libs` -lSDL_ttf -lglut -lGL -lGLU -lm

I can add that I have not written the Makefile (or the code), I’ve just overtaken this project and is trying to compile it before I start editing the source code.

Is here any way to get hold of the sorce code (.c-files) for OpenGL and include this in my sorce code in order to fix the problem?

Hang on a minute …

Are you trying to cross-compile an OpenGL program?

If so, you need to either cross-compile all of the libraries which it uses, or install pre-compiled versions for the appropriate target platform, and tell the compiler to use those.

Installing x86 (or x86-64 or whatever the host system is) packages won’t help you. Similarly, adding -I/usr/include won’t help (and may make things worse), because those files are for the host platform, not the target platform.

You can get the source code for an OpenGL library (Mesa), but that may not work on the target platform, which may require a specific OpenGL library from the hardware vendor.

None of this really has much to do with OpenGL per se. You’d probably be better off seeking a forum dedicated to whichever platform you’re targeting.

Ok, sounds resonable when you say it… Where can I find pre-compiled versions? And how do I know which is the approriate platform?
(As you probably understand by my utterly silly questions, I’m a complete newbie to linux programming and OpenGL…)

If you don’t know, we certainly don’t.

Which system are you trying to generate an executable for? Android? It’s some form of ARM-based system (that much is obvious from the fact that the C++ compiler is called “arm-none-linux-gnueabi-g++” rather than just “g++”).

If you were expecting it to run on a PC (x86 or x86-64), you should first find out if the program will actually run on one (ask whoever you got it from; we don’t know).

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.