Skip to main content
GameDev.net gamedev.net
🔒 Locked

opengl & linux

Started by cody Oct 21, 2001 at 6:39 AM 17 replies 1.1k views
Original Post
cody
cody
yesterday i installed suse linux 7.3. i wanted to make a small opengl program with gcc. but it doesnt find the gl headers and the lib file. so what do i need to compile a opengl program? a have already installed the nvidia display drivers for my geforce3 and it works. where do i get the library files, headers and dlls for gl? i noticed that linux uses other file extensions than windows. .dll=.so (i think) .lib=? what about kdevelop? is it good? it looks like vc... cody
Goober King
Goober King
Well I''m not even as far along as you are. I''m still
trying to get Linux to play nice with all my hardware.
But hell that was an up hill battle in windows.
anyway, if I recall you will need to download the openGL
header files. They are not included directly with the OS
generaly. They do get around alot so you may pick up the source
code somewhere or I think they are avalible on whatever OpenGL
site you might find. Most prog. that use OpenGL probably are
already precompiled so they have little need to supply u with
the source code. I think thats what I read somewhere.
------------------------------------------------------------- neglected projects Lore and The KeepersRandom artwork
Oluseyi
Oluseyi
Most Linux distros use Mesa, the Open Source implementation of the OpenGL spec (I believe it''s 1.2-compliant). Your GL header files should have been installed if you installed development packages; check your /usr/include directory. The appropriate libs should also be in /usr/lib.

Linux libraries are named lib*, where the * represents the package name. So the Standard C++ Library is libsdtc++, and the Mesa (OpenGL) libraries are libGL, libGLU (GLUT), etc. Library files come in two flavors: shared object and static libraries. Shared objecys (think: Windows DLLs) have the .so extensions, which would mean libGL.so for GL shared objects; and .a for static libs (libGL.a).

Have fun, kids!
Obelix
Obelix
I would use the extended headers from nvidia that you got with the drivers.
.lib=.a (archive)
Prefect
Prefect
Actually, .lib != .a

Windows uses .libs for both static linking and dynamic linking. In the latter case, the .lib just holds information about which functions are in the .dll.

On Linux, you use .a for static linking, and the .so holds both the actual library code and the linking information used w/ dynamic linking.

cu,
Prefect

One line of sourcecode says more than a thousand words.
Widelands - laid back, free software strategy
Obelix
Obelix
OK, but perhaps can you say .lib=.a and .so=.dll but you do not need any import libraries in linux.
LearFox
LearFox
Libraries under Linux have extensions with .so
or .so.. Example: libGL.so.1.2

If you have /usr/Somewhere/lib/libGL.so.1.2
then somewhere on yer linker line you need
-lGL and -L/usr/Somewhere/lib

Note that the lib prefix of the file name of
libGL.so.1.2 is omitted and also the extension
is omitted as well.
Tara Milana - WP Entertainmenthttp://wolfpack.twu.net/Comp graphics artist and programmer.
Neophyte
Neophyte
Usually you will find the openGL-headers in /usr/include/GL.
So just include GL/GL.h (or possibly GL/gl.h, I can''t remember right now).
Note that linux is case-sensitive, so be sure that the directory is GL and not gl.

-Neophyte
Biased turkey
Biased turkey
Did you include the OGL library in the command line for compiling:
gcc mysource.c -o myexecutable -lGL

I tried in vain to compile some oGL programs, and it worked after I included the GL library in the gcc command with the -l option.

I hope this helps
cody
cody
thanks for your help, but i didnt get it to work:-(

my problem is:
i searched for gl.h, libGL etc. and found some files... all in different directories and cant imagine how gcc should find them... so where must these files be?

-lGL doesnt work, gcc sais there are undefined references.
i used this header:
/usr/share/doc/packages/nv_glx/usr/include/GL/gl.h
(how should somebody find that??)
-there is a libGL.so.1.0.1541.nv_glx in /usr/lib, however i dont know how to use it, gcc also doesnt work when i copy the libGL to my working directory.

-in /usr/include are no gl headers

i would like to use the nvidia headers and libs like obelix said.

im totally confused... windows is easier...

cody
cody
cody
yeah, it seams your symlink works, thanks!
Obelix
Obelix
About the nvidia OpenGL headers should you move them to your normal GL include directory if you want to use them.
stefu
stefu
I installed too linux, Mandrake 8.1 and installation was very very easy.

I have a problem with KDevelop. I can''t create new projects/files (lol). The new button on toolbar and menu are grayed.
Maybe there''s something I don''t know yet about Linux
Hepl me to create new project/files.
Null and Void
Null and Void
quote:
Original post by stefu
I have a problem with KDevelop. I can''t create new projects/files (lol). The new button on toolbar and menu are grayed.


That''s odd. Not much lost though, I didn''t like KDevelop much when I tried it (it is overly complex for simple projects). If you get the time, read a tutorial on makefiles (they really aren''t as hard to do as they seem), maybe you''ll like using the command line as much as I do? (Anjuta and ETerm are all I need )

[Resist Windows XP''s Invasive Production Activation Technology!]
stefu
stefu
No worry I'll do it command line

I just found that I need to first make new project: Project -> ApplicationWizard. I was too common with VisualC ad looked just File -> New

edit:

Actually I found after a moment KDevelop complex, I'll not use it.

PS. Where to get glu.h for linux?

more edit:

Shall I ask where to put all sources, libraries ... in linux, how to organize all. Are there any rules/considerations so that whenever I get a code and it requires some libraries and header files to compile, it comples without any changes? Sorry for dumb question, but I'm quite first timer with Linux

Edited by - stefu on October 31, 2001 9:25:39 AM

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.