SDL and KDevelop

Hi people!

I am using KDevelop and SDL, and I new in C/C++ programming. I am reading
the manual in HTML format of SDL put I don’t know how I need to use #include
and SDL.h in my programs.

I was used #include “SDL.h” and #include <SDL.h", but not work. The include
files are all in /usr/local/include/SDL.

My first program;

#include “SDL/SDL.h”
#include <stdio.h>

main()
{

printf(“Activando la libreria SDL.\n”);

if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO)==-1)
{
printf(“No se puede activar SDL: %s.\n”, SDL_GetError());
exit(-1);
}

printf("\nSDL activada\n");

printf("\nDesactivando SDL… ");

SDL_Quit();

printf(“HECHO”);

}

Debian Woody 3, KDevelop 2.1.5, KDE 3.1.4, Gcc 3.2.3_________________________________________________________________
Charla con tus amigos en l?nea mediante MSN Messenger:
http://messenger.microsoft.com/es

Jfs Dlt wrote:

#include “SDL/SDL.h”

If you do #include <SDL.h>, then you need to tell your compiler where
the headers are located, which is usually done with the “sdl-config
–cflags” scripts, add this to the -I options of gcc (don’t know where
exactly in kdevelop this can be configured).

This has the advantage, if someone has the SDL headers in some obscure
directory which is not in the standard compiler search path, sdl-config
will point the compiler to the right directory.

A second way is to do #include <SDL/SDL.h> and don’t use sdl-config
script, then the SDL headers must be in some directory gcc looks into,
like /usr/include/SDL.

Simple example makefile for "#include “SDL.h”:

foo: foo.o
gcc -o foo foo.o sdl-config --libs
foo.o: foo.c
gcc -c foo.c sdl-config --cflags

I don’t use kdevelop, but there should be some dialog where you can
configure link and include flags, add the "sdl-config --cflags/libs"
stuff there and it should work. Or write a real Makefile and use this
with kdevelop.

Also check this:
http://www.geekcomix.com/snh/files/docs/sdl-kdev/sdl-kdev-mini-how2.html

Peter