hello ,im new to opengl coding just started a few days back,for a piece of code take from opengl prog.guide,i got lots of ‘undefined ref to gl* () functions’ when i hit compile on kdevelop ,i have mesa and then nvidia driver installed ,gl header files are stored at /usr/x11r6/include/GL
glut ,glx,gl,glu.h are present.
from terminal i did only compile without linking -result:success,but when i tried linking again ‘undefines reference’.
i tried gcc -o<app> <src.c> -L/usr/x11rc/include -|GL -|GLU -|glut but ot no avail.,
says GL,GLU,glut commands could not be found,
what am i doing wrong ,is there any other way of doing in,some one please help.
thanks…
You’re not including the headers correctly. Your -L string doesn’t match your directory, but you have also used -L instead of -I for the include path. You probably need both (different paths of course), you must also use #include <GL/*.h> for the includes to tell the compiler to use your link paths and look in the GL subdirectory?
I would have expected an earlier fatal error when the .h files couldn’t be found. When you have compiler errors always look to the first error for the source of the problem.
[This message has been edited by dorbie (edited 02-16-2004).]
Forgot to mention thanks,dorbie,but,
could be my libs arent in place ,are “gl/gl*.h” all thats needed what about the gl*.so’s. & the o files ,after installing nv drivers from nv’s site ,i got nv-versions of gl.h,glu.h and glx.h files in /usr/share/doc/NV-GLX…/ ,but without any reference to them in the documentation.
Sounds like linker errors, not compiler errors. As stated, you need to use -I to point to the directory of your headers, but you also need to use -L to point to the directory of your libraries. And you don’t use -|GL, etc, but -lGL. (That is a lower case L, not the vertical bar over the enter key.)
With any other additional libraries you need appended.
Also, Linux file and directory names are case sensitive, and usually the GL files are in a GL directory, not a gl directory, so you should include your headers like:
#include <GL/gl.h> #include <GL/glu.h>
Not:
#include <gl/gl.h> #include <gl/glu.h>
[This message has been edited by Deiussum (edited 03-02-2004).]