Question

I have a C-code which I have not managed to run http://dl.getdropbox.com/u/175564/problem-sdl.png

The problem is in OpenGL or SDL. I do not have SDL.h at /usr/local/SDL/SDL.h, so gcc cannot find it.

I have SDL.h installed by MacPorts at /opt/local/include/SDL/SDL.h.

I tried to copy it to /Masi/local/SDL/SDL.h unsuccessfully at the folder by

cp /opt/local/include/SDL/SDL.h /

and by

cp /opt/local/include/SDL/SDL.h /Masi/local/SDL/

I tried to solve the problem by creationg a symlink by

$ln -s /opt/local/include/SDL/SDL.h /Masi/local/SDL/SDL.h
Was it helpful?

Solution

No, Ubuntu does not have them by default (at least the development versions). For my own little program I just installed libsdl1.2-dev and mesa-common-dev (OpenGL).

For the build process I use scons which produces the following commands:

gcc -o src/geom.o -c -Wall -ansi src/geom.c
gcc -o src/main.o -c -Wall -ansi src/main.c
gcc -o test src/main.o src/geom.o -lSDL -lGL

If you install the libraries in some non-standard location, you might have to specify your own include (-I) and library (-L) paths.

OTHER TIPS

the simplest way to get all the compiler flags for SDL is by using sdl-config:

gcc sdl_gl_1.c $(sdl-config --cflags --libs) -lGL -lGLU
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top