Originally posted by karthickumar M:
[b]How to compail opengl (c)program in unix …
my system info
o200 server
IREX SGI computer
i know few things
for compail in LINUX(Red Hart 9)
cc <filename>.c -lglut -lGLU -lGL -lm
some Computer this command not working then i find the command…
2) cc <filename>.c -lglut -lGLU -lGL -lm -L/usr/X11R6/lib
my Query is
how to compail in unix?
why u have to add -L/usr/X11R6/lib some system with out this also working why?[/b]
Compiling under Linux/Unix should be almost the same. Linux generally provides the gnu compiler collection (c/c++/java/ada compilers) that are named gcc, g++ and such.
cc,c++ are just links of gcc,g++. Try a ls -al /usr/bin/cc for ensuring that.
So for your unix, you’ll have to find your compiler (maybe cc or egcs) or you might have (or install) gcc. But generally, cc is the Unix name for C compiler so you might use this one.
You need to specify extra directory for your libraries (and/or your headers) if your system doesn’t provide it at default.
See /etc/ld.so.conf for the libraries. If the directory is not listed there, then you’ll have to add the -L /dir.
after the comapiling opengl:
cc <filename>.c -lglut -lGLU -lGL -lm
(its giving such kind of error)
1).
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/…/…/…/libglut.so: undefined reference to XGetExtensionVersion' 2). .......XFreeDeviceList’
3).
…XQueryDeviceState' 4). ........XListInputDevices’
5).
…XFreeDeviceState' 6). .........XOpenDevice’
7).
…XmuLookupStandardColormap' 8). .........XSelectExtensionEvent’
cc filename.c -L/usr/X11R6/lib -lXmu -lXi -lglut -lGLU -lGL (this is working fine)
here
what is lXmu & lXi
unix
cc quad.c -lglut -lGLU -lGL -lm
ld32: ERROR 33 : Unresolved text symbol “XCreateWindow” – 1st referenced by /usr/lib32/libglut.a(glut_win.o).
Use linker option -v to see when and which objects, archives and dsos are loaded.
ld32: ERROR 33 : Unresolved text symbol “XTextWidth” – 1st referenced by /usr/lib32/libglut.a(glut_menu.o).
Use linker option -v to see when and which objects, archives and dsos are loaded.
ld32: ERROR 33 : Unresolved text symbol “XGetWindowProperty” – 1st referenced by /usr/lib32/libglut.a(layerutil.o).
Use linker option -v to see when and which objects, archives and dsos are loaded.
Those aren’t GL functions you’re missing: they’re X functions. On linux, you’ll probably have to link with -lX or -lXFree86 (I’m not sure which it is, I can’t look it up right now).
My guess is it works on the other system due to an environment variable for the compiler options.
To compile those sort of files, it depends in fact on your system. Some linux system can manage dependencies between libraries, some aren’t able. I really don’t know why some do that and other do not. Maybe you’re working on an older machine. If the libraries (GL.so,GLU.so and glut.so) have matching GL.la and so on, then automatic dependencies will be managed.
For example, my GL libraries stand in /usr/lib and are called libGL.so.* and libGL.la. la files are simple text files but I don’t advise you to write your own, they are made during installation. Also, ensure you have shared libraries (so) and not static library archive (.a).
X and Xmu are X libraries. You often need to link with one or all of them (often only Xmu when using glut). Just link with them with adding -lXmu will generally suffice.