[SDL] compiling problems with SDL.h

John Bailo jabailo at earthlink.net
Fri Nov 28 17:26:01 PST 2003


ronap at inwind.it wrote:

>Hi all,
>when I compile the code: 
>
>#include "SDL.h"   /* All SDL App's need this */
>#include <stdio.h>
>
>int main() {
>    
>    printf("Initializing SDL.\n");
>    
>    /* Initialize defaults, Video and Audio */
>    if((SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO)==-1)) { 
>        printf("Could not initialize SDL: %s.");
>    }
>
>    printf("SDL initialized.\n");
>
>    printf("Quiting SDL.\n");
>    
>    /* Shutdown all subsystems */
>    SDL_Quit();
>    
>    printf("Quiting....\n");
>
>    exit(0);
>}
>
>
>with command 
>
>gcc -o myfirst myfirst.c 
>
>the compiler say:
>
>SDL.h no such file or directory
>SDL_INIT_VIDEO undeclared
>SDL_INIT_AUDIO undeclared 
>
>Is gcc command correct ?
>
Try:

(1)  #include <SDL/SDL.h>
(2) compile with:

gcc -o myfirst `sdl-config --libs --cflags` myfirst.c

sdl-config automatically gets the correct path ( assuming you've 
installed the SDL library )


>
>
>
>Before compiling I have read sdl faq: 
>/etc/ld.so.conf contains the line /usr/local/lib, 
>as root I run /sbin/ldconfig.
>
>Other questions are:
>
>1) How I add /usr/local/bin in my execution path?
>2) Is It necessary to add /usr/local/bin in my execution path when I use gcc compiler?
>
>Many thanks in advance for your support. Ciao, Roberto
>
>
>_______________________________________________
>SDL mailing list
>SDL at libsdl.org
>http://www.libsdl.org/mailman/listinfo/sdl
>
>  
>






More information about the SDL mailing list