• Advertisement

Archived

This topic is now archived and is closed to further replies.

::BEWARE:: Newbie question contained**

This topic is 5713 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello all, I''ve only recently started to fiddle with this "linux" stuff. However, my utter newbism is making it hard to figure a few things out. I need to know Where are the GCC includes and libraries kept? In my Win32 Borland compiler, they''re all nicely kept together in C:\Borland\include and C:\Borland\lib\ but I can''t seem to figure out the equivilants in crazy ol'' linux. Actually, I''m trying to figure out how to set up SDL so I can 1) do some windows programming, and 2) try to learn SDL. I installed the SDL rpm, but I don''t know how to do things from there. ANy hElp = ThNx

Share this post


Link to post
Share on other sites
Advertisement
the includes and libs are usually in /usr/include and /usr/lib respectivelly, some may be on /usr/local/include and /usr/local/lib.

usually the package manager creates system variables so you dont really need to know where they are.

Regarding 1: you dont do "Windows" programing with SDL if you are refering to standard Applications with textboxes, comboboxes, and such, you will need X, GTK+ or wmWindows (the later being cross platform).

About 2: Read the documentation on www.libsdl.org, the Doc Project, the documentation that is available in multiple languages is quite useless, there are some tutorials on cone3d.gamedev.net and NeHe has some SDL ports as well if you are into OpenGL.

for compiling:
gcc -c yourcode.cpp `sdl-config --cflags`

for linking:
gcc yourcode.o `sdl-config --libs` -lGL -lGLU -o yourcode

-lGL -lGLU is only needed if using OpenGL, you need to link with other libs you might need like -lstdc++ or -lm.


Share this post


Link to post
Share on other sites
/usr/lib
/usr/include

contrary to the way its done on crazy ole windows, *nix headers and libraries are "global"... although if a compiler WERE to keep its own headers/libraries... They''d probably be under /usr/share/name_of_weird_compiler/include

Just for reference All the major compilers for nix (gcc, *bsd''s cc, egcs) will use /usr/include and /usr/lib

Windows programming? on nix? I hope you mean Xwindows, otherwise thats just weird.

--

As for SDL, You say you installed the rpm? well... write your SDL program and compile it like

gcc file.c -o program -lSDL
-or-
gcc file.c -o program `sdl-config --c-flags`

Can''t remember if SDL uses that system or not... anybody who''s not working off of memory here care to tell which one it is?

Share this post


Link to post
Share on other sites
holy responses, batman!

when I started writing there weren''t any...

this place gets lurked a lot i guess

Share this post


Link to post
Share on other sites
OK, I think I may still be a little lost. Let me get this straight =-) In /usr/include, all the files are *.la''s or *.so''s, so I''m guessing these are equivalents to *.libs and *.dlls?

Also, in my /usr/include/ folder, I checked and there is no SDL.h file (though there were 2 library files for it). I''ll try reading up on the install documentation, though.

Also, for the record, I neglected to capitolize the unholy ''w'' in windows, implying a more generic sense of the word. I could have said "non-MicroSoft graphical environment-based programming", but I just figured "w****** programming" would suffice. I apologize if I have offended anyone =-)

Lastly, thankyuu all for your prompt responses =-)

Share this post


Link to post
Share on other sites
Hrmm....

I tried both

gcc file.c -o program -lSDL
gcc file.c -o program `sdl-config --c-flags`

but the first one simply didn''t work and the second one yelled angrily at me, telling me BASH couldn''t find sdl-config. I''m still playing with it though.

Share this post


Link to post
Share on other sites
quote:
Original post by Tac-Tics
Hrmm....

I tried both

gcc file.c -o program -lSDL
gcc file.c -o program `sdl-config --c-flags`

but the first one simply didn''t work and the second one yelled angrily at me, telling me BASH couldn''t find sdl-config. I''m still playing with it though.



This would seem to indicate that you haven''t yet installed SDL...

-- Aaron


| HollowWorks.com | Rhott.com |

Share this post


Link to post
Share on other sites
there are 2 packages on your redhat instalation CDs, SDL and SDL-devel. the first one is needed to RUN programs made with SDL, the later is for Developing apps using SDL (IE Make the programs), install both, then try to look for SDL.h, think of them as you think of the DirectX Runtime libs and the DirectX SDK.

# where SDL.h

should tell you where SDL.h is, otherwhise you can use

# find / -name "SDL.h"



Share this post


Link to post
Share on other sites
Aighty, obviously I shouldn't rely on RPM's to do anything useful =-/ I successfully compiled it from the source code and threw together a sample program and I got a nice, blank windo....err... Xwindow ^_^

Anyway, I might as well inquire furthur. I tried grafting OpenGL to my little SDL program, but I found something out: the glu.h is missing =-( I tried #include <glu.h> and #include <GL/glu.h> and looked hard through /usr/include/ but to no avail. So, I guess now I should ask:
1) am I REALLY missing glu.h? Would there be any way it didn't come with my version of Lin (Mandrake distro)?
and
2) how do I find/get glu.h? Can I just find a copy and throw it in my /usr/include/ dir? Or is there some other way that would be more proper to installing it?

Please forgive the newbism.

::EDIT::
Also, I should note. When I try to compile a test program with OpenGL and SDL, I get the following errors:

Xlib: extension "GLX" missing on display ":0.0".
Xlib: extension "GLX" missing on display ":0.0".

Can anyone explain to me what these might mean? I can provide the source if I need to.


[edited by - Tac-Tics on June 28, 2002 2:28:02 AM]

Share this post


Link to post
Share on other sites
You are missing glx in your system.

What video adapter do you have? nvidia/ati/...?

In case you have nvidia goto nvidia web pages and download newest drivers. For other accelerator manufacturers I can''t help

Share this post


Link to post
Share on other sites
quote:
Original post by Tac-Tics
Aighty, obviously I shouldn''t rely on RPM''s to do anything useful =-/ I successfully compiled it from the source code and threw together a sample program and I got a nice, blank windo....err... Xwindow ^_^

Anyway, I might as well inquire furthur. I tried grafting OpenGL to my little SDL program, but I found something out: the glu.h is missing =-( I tried #include <glu.h> and #include <GL/glu.h> and looked hard through /usr/include/ but to no avail. So, I guess now I should ask:
1) am I REALLY missing glu.h? Would there be any way it didn''t come with my version of Lin (Mandrake distro)?
and



This is possible, but seems strange if you are using a recent distrobution.

quote:

2) how do I find/get glu.h? Can I just find a copy and throw it in my /usr/include/ dir? Or is there some other way that would be more proper to installing it?



The most common implementation of GL for linux is MESA/GLUT, there are some straight answers here:

http://esupport.csci.unt.edu/programming/mesa_glut.php

You might also take a look at the downloads and documentation sections of: http://www.opengl.org

Also, if you haven''t looked, there is some info on setting up GL with SDL on the libsdl.org page under "Doc Project."

quote:

Please forgive the newbism.



You have to start somewhere

quote:

::EDIT::
Also, I should note. When I try to compile a test program with OpenGL and SDL, I get the following errors:

Xlib: extension "GLX" missing on display ":0.0".
Xlib: extension "GLX" missing on display ":0.0".

Can anyone explain to me what these might mean? I can provide the source if I need to.



On this, I''m not completely certain. I would think that this would be related to having a version of XF86 that doesn''t support GL. You should be able to setup X for GL, but I think the newer implementations of XF86 should already have this built in.

You shouldn''t need specific drivers for your video card (though just like in windows, they really speed things up), if X supports GL, because SDL should run in software emulation mode if there aren''t any drivers.

Somebody correct me if I''m wrong here, I don''t have tremendous experience with GL in *nix.

-- Aaron

| HollowWorks.com | Rhott.com |

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
for the GLX error...

You''d have to add GLX support to your X server... for a standard X install you''d just have to add a line like

Load "GLX"

to the modules section of your Xserver configuration (usually /etc/X11/XF86Config) You do need the module, but unless your distribution sucks, it should be there already, if not... You''ll have to install something like mesa or (for NVidia people) Nvidia''s drivers.

As for compiling, it seems you''ve been successful, but for the record... the second post has the correct method.

to get GLX also try #include <X11/GLX.h> and the like... I''m going off of memory here, not sure which

Share this post


Link to post
Share on other sites

  • Advertisement