View Full Version : undefined references to gl/under mandrake 9/nvidia
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.
02-15-2004, 11:54 PM
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).]
i tried even with -I,linker still says 'undefined reference to gl*()';
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.
You need to copy the nvidia headers to /usr/X11R6/include/GL
check that there is a symlink in the directory /usr/include called GL that points to /usr/X11R6/include/GL
gcc -o program program.c -lGL -lGLU (whatever else you need -lm etc..)
03-02-2004, 04:39 AM
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.)
So... a typical command line might look like so:
gcc -o myapp myapp.c -I/usr/X11R6/include -L/usr/X11R6/lib -lGL -lGLU -lglut
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:
[This message has been edited by Deiussum (edited 03-02-2004).]
i never realized i could be this silly,that one came in time ,thanks Deiussum and also every one who tried to help.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.