Compiling problems with SDL.h

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 ?

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

[…]

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 gcc -o a a.c sdl-config --cflags sdl-config --libs

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?
    if u are using bash then edit ~/.bashrc and add export
    PATH=$PATH:/usr/local/bin
  1. Is It necessary to add /usr/local/bin in my execution path when I
    use gcc compiler?

only when gcc is in /usr/local/bin and /usr/local/bin is not in $PATH

Many thanks in advance for your support. Ciao, Roberto

Hok

---------- Initial Header ----------->From : sdl-admin at libsdl.org
To : “sdl” sdl at libsdl.org
Cc :
Date : Fri, 28 Nov 2003 13:46:45 +0100 (CET)
Subject : Re: [SDL] compiling problems with SDL.h

Hi, Hok

try gcc -o a a.c sdl-config --cflags sdl-config --libs

I have used:

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

and I have added export PATH=$PATH:/usr/local/bin
in /home/roberto/.bashrc

Besides, I have finded other library SDL in my mpeg4ip project and I have renamed the file config.cache in config.cache-old in SDL directory ($ locate config.cache return /home/projects/SDL-1.2.6/config.cache)

but compiler’s answere is:

sdl-config --cflags no such file or directory
sdl-config --libs no such file or directory
SDL.h no such file or directory
SDL_INIT_VIDEO undeclared
SDL_INIT_AUDIO undeclared

How I compile my files?

Kinds regards, Roberto


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

---------- Initial Header -----------

Cc :

Hi, Hok

try gcc -o a a.c sdl-config --cflags sdl-config --libs

I have used:

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

and I have added export PATH=$PATH:/usr/local/bin
in /home/roberto/.bashrc

Besides, I have finded other library SDL in my mpeg4ip project and I
have renamed the file config.cache in config.cache-old in SDL
directory ($ locate config.cache return
/home/projects/SDL-1.2.6/config.cache)

but compiler’s answere is:

sdl-config --cflags no such file or directory
sdl-config --libs no such file or directory
SDL.h no such file or directory
SDL_INIT_VIDEO undeclared
SDL_INIT_AUDIO undeclared

How I compile my files?

sami at high-voltage ~ $ whereis sdl-config
sdl-config: /usr/bin/sdl-config

if it didn’t find it then it is not in standard path.
Means that in your distribution /usr/local/bin doesn’t belong to your
path.

Your standard path can be viewed using the next command

sami at high-voltage ~ $ echo $PATH
~/bin:/bin:/usr/bin:/usr/local/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/3.3:/opt/Acrobat5:/usr/X11R6/bin:/opt/blackdown-jdk-1.4.1/bin:/opt/blackdown-jdk-1.4.1/jre/bin:/usr/qt/3/bin:/usr/kde/3.1/bin:/usr/games/bin:/var/qmail/bin

So to add a directory to that path in your current shell do the next
export PATH=’/usr/local/bin:$PATH’

Now you can compile your SDL programs easily.
gcc sdl-config --cflags --libs -c myfirst myfirst.cOn Friday 28 November 2003 21:53, ronap@inwind.it wrote:

From : sdl-admin at libsdl.org
To : “sdl” sdl at libsdl.org
Date : Fri, 28 Nov 2003 13:46:45 +0100 (CET)
Subject : Re: [SDL] compiling problems with SDL.h

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

I have used:

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

and I have added export PATH=$PATH:/usr/local/bin
in /home/roberto/.bashrc

Besides, I have finded other library SDL in my mpeg4ip project and I have renamed the file config.cache in config.cache-old in SDL directory ($ locate config.cache return /home/projects/SDL-1.2.6/config.cache)

but compiler’s answere is:

sdl-config --cflags no such file or directory
sdl-config --libs no such file or directory
SDL.h no such file or directory
SDL_INIT_VIDEO undeclared
SDL_INIT_AUDIO undeclared

How I compile my files?

You need backticks, `, not apostrophes, '. The apostrophes makes the
shell pass the whole string inside them as one command line parameter,
that is, making gcc believe it’s a filename you want to compile. The
backticks makes the shell execute the command inside them and put the
output in the command line.–
Petri Latvala

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 ?

No (see below).

Before compiling I have read sdl faq:

What about this one?
http://www.libsdl.org/faq.php?action=listentries&category=3#21

  1. How I add /usr/local/bin in my execution path?

This depends on your shell. Bash is covered in the FAQ above (question
23 this time).
I suggest reading an introductory guide to UNIX: This and many other
important things should be covered in one.

  1. Is It necessary to add /usr/local/bin in my execution path when I
    use gcc compiler?

Only if you are using a binary in there. Where is sdl-config (assuming
you follow the advice in the faq link above)?On Thu, Nov 27, 2003 at 09:26:05PM +0100, ronap at inwind.it wrote:


Jonathan Dowland
http://jon.dowland.name/

Hi all,
with the commands:

  1. $ whereis sdl-config
    sdl-config: /usr/bin/sdl-config /usr/local/bin/sdl-config

  2. $ echo $PATH
    /usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/roberto/bin

  3. gcc ?o myfirst myfirst.c ?sdl-config --cflags --libs?

and myfirst.c with #include ?SDL.h? or #include ?SDL/SDL.h? or #include <SDL/SDL.h>,

the compiler?s answere is:

sdl-config ?cflags ?libs no such file or directory
library.h no such file or directory …

Why I do not compile my file?

Please, help me. Thanks.

Roberto

---------- Initial Header ----------->From : sdl-admin at libsdl.org
To : sdl at libsdl.org
Cc :
Date : Fri, 28 Nov 2003 17:25:01 -0800
Subject : Re: [SDL] compiling problems with SDL.h


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

ronap at inwind.it wrote:

Hi all,
with the commands:

  1. $ whereis sdl-config
    sdl-config: /usr/bin/sdl-config /usr/local/bin/sdl-config

  2. $ echo $PATH
    /usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/roberto/bin

  3. gcc -o myfirst myfirst.c ‘sdl-config --cflags --libs’

Wrong syntax.

This is

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

[notice these quotes are backquotes and not quotes]

Stephane

Hi all,

my compiling problem with SDL has been resolved. The correct command line is with BACKQUOTES and not quotes.

gcc -o myfirst myfirst.c ‘sdl-config --cflags --libs’ WRONG sintax

gcc -o myfirst myfirst.c sdl-config --cflags --libs CORRECT sintax

Jonathan Dowland, Jan Kratochvil, Sami Naatanen, John Bailo, Stephane Marchesin: thanks for your support.

Regards, Roberto

---------- Initial Header -----------

Cc :>From : sdl-admin at libsdl.org
To : sdl at libsdl.org
Date : Mon, 01 Dec 2003 20:40:46 +0100
Subject : Re: [SDL] compiling problems with SDL.h

hi all,

just another point: if you are working with QT
designer and SDL together on linux system. just add
this : -L/usr/lib -lSDL to the LIBS line in the
Makefile that you generated using the qmake.
hope that would help

cheers

— “ronap at inwind.it” wrote: >> Hi all,

my compiling problem with SDL has been resolved. The
correct command line is with BACKQUOTES and not
quotes.

gcc -o myfirst myfirst.c ‘sdl-config --cflags
–libs’ WRONG sintax

gcc -o myfirst myfirst.c sdl-config --cflags --libs CORRECT sintax

Jonathan Dowland, Jan Kratochvil, Sami Naatanen,
John Bailo, Stephane Marchesin: thanks for your
support.

Regards, Roberto

---------- Initial Header -----------

From : sdl-admin at libsdl.org
To : sdl at libsdl.org
Cc :
Date : Mon, 01 Dec 2003 20:40:46 +0100
Subject : Re: [SDL] compiling problems with SDL.h


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Download Yahoo! Messenger now for a chance to win Live At Knebworth DVDs
http://www.yahoo.co.uk/robbiewilliams

Another solution is to not use backticks at all, to save confusion for
newbies.

try this:

gcc -o myfirst myfirst.nc $(sdl-config --cflags --libs)On Monday 01 December 2003 11:40 am, Stephane Marchesin wrote:

ronap at inwind.it wrote:

Hi all,
with the commands:

  1. $ whereis sdl-config
    sdl-config: /usr/bin/sdl-config /usr/local/bin/sdl-config

  2. $ echo $PATH
    /usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/roberto/bin

  3. gcc -o myfirst myfirst.c ‘sdl-config --cflags --libs’

Wrong syntax.

This is

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

[notice these quotes are backquotes and not quotes]

Stephane


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


"They that can give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety. "
–Benjamin Franklin