Can't compile

Hi,

I’m trying to make SDL work on my Fedora Core 3 system with Xfce4.
When I want to compile any of the example, my compiler gives the
following error:

SDL.h: No such file or directory

As described in the FAQ, I did the following steps:

*) Edit the file /etc/ld.so.conf, and make sure it contains the line:
/usr/local/lib
*) As root, run /sbin/ldconfig
*) export PATH=$PATH:/usr/local/bin/
(nothing visually happened when running the two last commands, but
there were no error messages and there was no 'command not found’
message)

Then the FAQ says:

[QUOTE]If all of the above still don’t work, send e-mail to the SDL
mailing list with the output from the following commands run from the
directory of the software that refuses to build: [/QUOTE]

which sdl-config

/usr/local/bin/sdl-config

sdl-config --version

1.2.8

locate libSDL

/usr/lib/libSDL_net-1.2.so.0
/usr/lib/libSDL_net-1.2.so.0.0.5
/usr/lib/libSDL_mixer-1.2.so.0.2.3
/usr/lib/libSDL_mixer-1.2.so.0
/usr/lib/libSDL-1.2.so.0
/usr/lib/libSDL-1.2.so.0.7.0

tail config.log

#define PACKAGE_TARNAME “”
#define PACKAGE_VERSION “”
#define STDC_HEADERS 1
#define VERSION “1.2.8”
#define X_DISPLAY_MISSING 1
#endif
#ifdef __cplusplus
extern “C” void std::exit (int) throw (); using std::exit;

configure: exit 0

I really hope someone can help me…

Greetz,

Bernard Fran?ois

I’m trying to make SDL work on my Fedora Core 3 system with Xfce4.
When I want to compile any of the example, my compiler gives the
following error:

SDL.h: No such file or directory

I would like to help but you’re no giving enough information.
What example are you compiling and what is the command you used
to compile it.

Note that as you can see that compiler is not finding SDL.h, and
normally it should in SDL/SDL.h which in turn should be in your
includepath, check where SDL.h is (by doing a ‘locate SDL.h’ , use
updatedb first if needed) and then check if that directory is given
after a -I switch to gcc.

Greetings,

Jan

I’m trying to make SDL work on my Fedora Core 3 system with Xfce4.
When I want to compile any of the examples, my compiler gives the
following error:

SDL.h: No such file or directory

I would like to help but you’re no giving enough information.
What example are you compiling and what is the command you used
to compile it.
Note that as you can see that compiler is not finding SDL.h, and
normally it should in SDL/SDL.h which in turn should be in your
includepath, check where SDL.h is (by doing a ‘locate SDL.h’ , use
updatedb first if needed) and then check if that directory is given
after a -I switch to gcc.

What do you mean with that ‘-I switch to gcc’ ?
I changed the includepath from SDL.h to SDL/SDL.h and now the ‘No such
file or directory’-problem is gone. However, it’s still not compiling.
This is what the shell tells me:

[QUOTE]
gcc graywin.c -o graywin
/tmp/ccNPSFAR.o(.text+0xea): In function DrawBox': : undefined reference toSDL_MapRGB’
/tmp/ccNPSFAR.o(.text+0x102): In function DrawBox': : undefined reference toSDL_FillRect’
/tmp/ccNPSFAR.o(.text+0x11f): In function DrawBox': : undefined reference toSDL_Flip’
/tmp/ccNPSFAR.o(.text+0x135): In function DrawBox': : undefined reference toSDL_UpdateRects’
/tmp/ccNPSFAR.o(.text+0x15c): In function DrawBackground': : undefined reference toSDL_LockSurface’
/tmp/ccNPSFAR.o(.text+0x16e): In function DrawBackground': : undefined reference toSDL_GetError’
/tmp/ccNPSFAR.o(.text+0x24a): In function DrawBackground': : undefined reference toSDL_MapRGB’
/tmp/ccNPSFAR.o(.text+0x2a2): In function DrawBackground': : undefined reference toSDL_UnlockSurface’
/tmp/ccNPSFAR.o(.text+0x2bf): In function DrawBackground': : undefined reference toSDL_Flip’
/tmp/ccNPSFAR.o(.text+0x2d7): In function DrawBackground': : undefined reference toSDL_UpdateRect’
/tmp/ccNPSFAR.o(.text+0x31c): In function CreateScreen': : undefined reference toSDL_SetVideoMode’
/tmp/ccNPSFAR.o(.text+0x333): In function CreateScreen': : undefined reference toSDL_GetError’
/tmp/ccNPSFAR.o(.text+0x3ff): In function CreateScreen': : undefined reference toSDL_SetColors’
/tmp/ccNPSFAR.o(.text+0x439): In function main': : undefined reference toSDL_Init’
/tmp/ccNPSFAR.o(.text+0x44b): In function main': : undefined reference toSDL_GetError’
/tmp/ccNPSFAR.o(.text+0x7b5): In function main': : undefined reference toSDL_WaitEvent’
/tmp/ccNPSFAR.o(.text+0x83e): In function main': : undefined reference toSDL_WarpMouse’
/tmp/ccNPSFAR.o(.text+0x939): In function main': : undefined reference toSDL_Quit’
collect2: ld returned 1 exit status

Compilation exited abnormally with code 1 at Sun Mar 6 22:48:09
[/QUOTE]

If I try to locate files named SDL_MapRGB, SDL_FillRect, SDL_Flip, …
(names mentioned in the errors), I mostly only find files in the docs
of SDL or in the man pages.

Thanks in advance,
Bernard

I changed the includepath from SDL.h to SDL/SDL.h and now the ‘No such
file or directory’-problem is gone. However, it’s still not compiling.
This is what the shell tells me:

Now you have a linker problem. Congratulations, this means you fixed the
compiler problem :slight_smile:

You’re not linking to the SDL library. Add -lSDL to the command line.

If I try to locate files named SDL_MapRGB, SDL_FillRect, SDL_Flip, …
(names mentioned in the errors), I mostly only find files in the docs
of SDL or in the man pages.

These are function names, not file names.
–Gabriel

Now you have a linker problem. Congratulations, this means you fixed the
compiler problem :slight_smile:

You’re not linking to the SDL library. Add -lSDL to the command line.

Thanks for your help, now the linker problem is solved. It’s the first
time that I’m working with an external library in C++… (I’m learning
C++ at school).
The command line I used to compile:
gcc file.c -lSDL -o file

On to the next problem:
When I want to compile any of the examples, its works, but when I want
to run the created executables, the shell says:

[QUOTE]
Couldn’t initialise SDL: No available video device
[/QUOTE]

Please no. Don’t guess the flags yourself, use sdl-config.

The correct way to include the SDL header is to #include “SDL.h”. The
reason is that not all platforms have the SDL.h in a directory named
SDL. The compiler flags tell the compiler where the headers should be
looked for.

The compiler command line should have sdl-config --cflags. Note, is not '. Use backticks, not apostrophes. The linker line should havesdl-config --libs`. If you do both on the same command, like you do
above, you can do this.

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

Why should you use sdl-config instead of your own flags? Because the
needed flags are different on each platform. Even on different linux
distributions there are different setups that require different
flags. The header location for compiling is not enough, -D_REENTRANT
is also sometimes needed to compile stuff thread-safely. When people
install SDL locally, they have it in /usr/local/lib which is not
always in the default library search path, so sdl-config --libs also
outputs the library search directory. Also you sometimes have to link
to pthreads. sdl-config does all the work, so use it.On Mon, Mar 07, 2005 at 12:14:38AM +0100, Bernard Fran?ois wrote:

Now you have a linker problem. Congratulations, this means you fixed the
compiler problem :slight_smile:

You’re not linking to the SDL library. Add -lSDL to the command line.

The command line I used to compile:
gcc file.c -lSDL -o file


Petri Latvala
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20050307/480a43a5/attachment.pgp

file.c -o file sdl-config --cflags --libs

Thanks, now I can compile the examples without needing to change the
include path.

But maybe a disadvantage of it is that the executable is a little
larger with this method becuase you link more libraries compared to
when you manually select the ones you want to link. But the difference
is only 50bytes if noticed that correctly.
Maybe I’m wrong, I don’t know much about all this linking.

Anyway, your method is much handier.

However, it still doenst work if I execute the compiled file, this is
what the compiler says:

[QUOTE]
Couldn’t initialise SDL: No available video device
[/QUOTE]

Does anyone know how I could make it work? I want to make a
visualisation of the ‘traveling salesman problem’, which I have to
code for school (using the tabu search method)…

Thanks in advance,

Bernard

Hi there.

"Couldn’t initialise SDL: No available video device "
is a OS error very common on Unix-Like Systems, where
the X is implemented as a server.
Try to run your application from the X or other
desktop (like XFCE, KDE, Gnome, ICEWM, …)
This error happens when you do not have the X server
started and need to run some application that needs
it, or, the X server was started by another user and
your application are not able to “talk” with the X
instance wich is running.

As a matter of fact, you did not mentioned wich OS
you are using, so I though it was *nix, because it is
where I see this kind of error happening.

Have a nice day,

In?cio.

— Bernard Fran?ois
wrote:> > file.c -o file sdl-config --cflags --libs

Thanks, now I can compile the examples without
needing to change the
include path.

But maybe a disadvantage of it is that the
executable is a little
larger with this method becuase you link more
libraries compared to
when you manually select the ones you want to link.
But the difference
is only 50bytes if noticed that correctly.
Maybe I’m wrong, I don’t know much about all this
linking.

Anyway, your method is much handier.

However, it still doenst work if I execute the
compiled file, this is
what the compiler says:

[QUOTE]
Couldn’t initialise SDL: No available video device
[/QUOTE]

Does anyone know how I could make it work? I want to
make a
visualisation of the ‘traveling salesman problem’,
which I have to
code for school (using the tabu search method)…

Thanks in advance,

Bernard


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


Yahoo! Acesso Gr?tis - Instale o discador do Yahoo! agora. http://br.acesso.yahoo.com/ - Internet r?pida e gr?tis

Did you compile SDL yourself? It detects on compiletime what libraries
are present and links only those in. It’s possible to compile SDL
without support for X11 backend, making it quite useless…

This brings up again my old feature request of adding a function that
returns the backends compiled into SDL.On Tue, Mar 08, 2005 at 10:59:36AM +0100, Bernard Fran?ois wrote:

However, it still doenst work if I execute the compiled file, this is
what the compiler says:

[QUOTE]
Couldn’t initialise SDL: No available video device
[/QUOTE]


Petri Latvala
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20050308/1f1c9ebd/attachment.pgp

Try to run your application from the X or other
desktop (like XFCE, KDE, Gnome, ICEWM, …)
This error happens when you do not have the X server
started and need to run some application that needs
it, or, the X server was started by another user and
your application are not able to “talk” with the X
instance wich is running.

I’m using fedora core 3 with xfce4 on a toshiba tecra8000 laptop. I
log in manually so I know that it was the same user that logged in as
the one who compiled the program and tried to execute it.

Did you compile SDL yourself? It detects on compiletime what libraries
are present and links only those in. It’s possible to compile SDL
without support for X11 backend, making it quite useless…

I compiled SDL myself.

I did some more searches on google and maybe the problem is that I
don’t have the X11 development packages, including libraries like X.h
and Xlib.h … But then the compiler should have given an error I
suppose…

Maybe I can try to install fedora linux again on an other computer,
make sure that I have all possible development packages, some
different desktop managers, and see if it works then…

Greetz,

Bernard

I compiled SDL myself.

I did some more searches on google and maybe the problem is that I
don’t have the X11 development packages, including libraries like X.h
and Xlib.h … But then the compiler should have given an error I
suppose…

No, the configure script detects that and the X stuff is not compiled
in. So no error, but no X support either.

Maybe I can try to install fedora linux again on an other computer,
make sure that I have all possible development packages, some
different desktop managers, and see if it works then…

Why don’t you just use the SDL rpm that’s in Fedora?On Tue, Mar 08, 2005 at 09:26:17PM +0100, Bernard Fran?ois wrote:


Petri Latvala
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20050308/f71bf640/attachment.pgp

Why don’t you just use the SDL rpm that’s in Fedora?

I can’t install them. When I insert the first fedora disc and I start
the autorun, I can select the packages that I want to install. When I
want to start the installation, the program asks to press ‘ok’ after
inserting the 2nd fedora disc. I can’t remove the disk since I can’t
unmount because the fedora installer is still using the cd. If I force
my cd-rom drive to open (by pressing the button in the hole on the
front of the cd-rom drive with a fold-open paperclip), and I insert
the right fedora disc and mount it, then after clicking the 'ok’
button, the fedora installation says it can’t find the right cd.
So I just copied the fedora cd’s to a folder on the hard drive, and I
tried to run the autorun file, but it immediately asked to insert the
first cd…
I’m still trying to find a solution right now. I don’t feel like
starting to install rpm packages manually, since I experienced that
installing an rpm mostly leads to installing several others, while for
each of them there’s a high risk of failing…

— Bernard Fran?ois
escreveu:
At my home machine, I run Slackware 10, and at my job
I run Fedora.
On the right time, Anaconda (Fedora / RedHat
installer) will eject the media and wait for the next
one. It Happened on Fedora Core 1 and Fedora Core 3 (I
never Installed Fedora Core 2), but It always worked
(including Red Hat).
If the media is not ejected right the dialog appears,
wait just a litte.
Other thing you can do is check the media (I always
check after burning the media).

Let me know if I missed some point.

In?cio.> > Why don’t you just use the SDL rpm that’s in

Fedora?

I can’t install them. When I insert the first fedora
disc and I start
the autorun, I can select the packages that I want
to install. When I
want to start the installation, the program asks to
press ‘ok’ after
inserting the 2nd fedora disc. I can’t remove the
disk since I can’t
unmount because the fedora installer is still using
the cd. If I force
my cd-rom drive to open (by pressing the button in
the hole on the
front of the cd-rom drive with a fold-open
paperclip), and I insert
the right fedora disc and mount it, then after
clicking the 'ok’
button, the fedora installation says it can’t find
the right cd.
So I just copied the fedora cd’s to a folder on the
hard drive, and I
tried to run the autorun file, but it immediately
asked to insert the
first cd…
I’m still trying to find a solution right now. I
don’t feel like
starting to install rpm packages manually, since I
experienced that
installing an rpm mostly leads to installing several
others, while for
each of them there’s a high risk of failing…


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


Converse com seus amigos em tempo real com o Yahoo! Messenger

If the media is not ejected right the dialog appears,
wait just a litte.
Other thing you can do is check the media (I always
check after burning the media).

I didn’t check the media, but I dont think it will change the fact
that I can’t open my cd drive… Maybe the cd-rom drive of the laptop
I’m working on can’t be opened without someone pressing the eject
button?
I asked the question on a fedora forum, one person replied that I
could use yum as an alternative. So I checked the packages in the ‘X
development’ section of the fedora add/remove packages program, and I
installed the following packages:

SDL_image-devel.i386
SDL_mixer-devel.i386
openmotiv-devel.i386
libpng10-devel.i386

I also tried SDL.i386 and SDL-devel.i386, but in these cases, yum
said: ‘nothing to do’ (since I already installed those packages
manually).

Especially SDL_image-devel.i386 caused a lot of other packages to
install (including several packages starting with ‘xorg’).

Normally, yum checks inter-dependencies between the packages, so
everything should be there. To be sure of that, I wanted to uninstall
(and re-install) SDL, but then yum asked to remove several other
programs (like tuxracer). I also tried that with SDL-devel, but then
yum asked to uninstall SDL_image-devel, so I just pressed no. (SDL and
SDL-devel are still on the pc, I checked that)

After all this, I tried to compile some of the examples. Most of them
returned this:

Couldn’t initialise SDL: No available video device.

And the opengl.c example returned this:

No OpenGL support on this system.

It is not the case that I don’t have OpenGL support; SDL-based games
like FreeCiv and Tuxracer work on this computer.

I really don’t know what to do now…

I’ll start reading some more information about X here:
http://www-h.eng.cam.ac.uk/help/tpl/graphics/X/X11R5/Concise.html
Maybe I’ll just start programming using Xlib… But then I won’t be
able to compile my programs for M$ Windows users :-(.

After all this, I tried to compile some of the examples. Most of them
returned this:

Couldn’t initialise SDL: No available video device.

Did you remove the SDL you compiled yourself?

And the opengl.c example returned this:

No OpenGL support on this system.

That error message is just plain wrong. It means "the SDL library used
does not have OpenGL support compiled in."On Wed, Mar 09, 2005 at 11:39:53AM +0100, Bernard Fran?ois wrote:


Petri Latvala
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20050309/2bfc7635/attachment.pgp