[SDL] in linux

Started by
32 comments, last by let_bound 17 years, 1 month ago
Im going to test it tomorrow , because i have to finish a school project under windows at the moment!.

I'll post again soon..
Advertisement
Im getting this error in MAIN.cpp:

Main.cpp:5:27: error: SDL/SDL_Mixer.h: No such file or directory

Can you help please?!

[edited]
And as you can see:
Reading package lists... DoneBuilding dependency tree       Reading state information... Donelibsdl-mixer1.2-dev is already the newest version.0 upgraded, 0 newly installed, 0 to remove and 17 not upgraded.


i have the latest dev version of sdl_mixer
[edited again]
And how do i run my program?!
When i include #include "SDL.h" only , im getting this error:
Main.cpp:24: error: expected constructor, destructor, or type conversion before ‘*’ tokenMain.cpp:32: error: expected constructor, destructor, or type conversion before ‘*’ tokenmore errors..


The code of line 24:
Mix_Chunk *BALL_JMP = NULL;


The code of line 32
TTF_Font *font = NULL;
[bump]
The most portable way of #including SDL headers is like this (source):

#include "SDL_headername.h", and not "SDL/SDL_header.h".



Then on linux use `sdl-config --cflags` to get the SDL include directories.

On windows I pass the flag -I"C:\path\to\include\SDL" to gcc so the SDL subdirectory is searchable when including files.
What rip-off said (as stated in the SDL FAQ).

Also, most filesystems for *NIX-like systems are case-sensitive: it's SDL_mixer.h, not SDL_Mixer.h.

Hope this helps.
So , the final command should be this ? :

g++ -o TEST Main.cpp sClasses_.cpp sLoad.cpp `sdl-config --cflags --libs -I"usr/lib"` -lSDL_mixer -lSDL_image -lSDL_ttf
I compiled the program , but when i double click on "test.o" the screen turns black for a second , and it drops me to the desktop....why is this ?!

The error:

username:~/Desktop/test ./TESTopen /dev/sequencer: No such file or directoryErr Mix_LoadWAV_RW with NULL srcSegmentation fault (core dumped)


[edited]

I did this:
 sudo modprobe snd-seq-midi


And now it shows this:
Err Mix_LoadWAV_RW with NULL srcSegmentation fault (core dumped)


[EDITED.AGAIN]

I replaced
this line:
Mix_LoadWAV( "Data\\snd\\0.wav" );

with this one:
Mix_LoadWAV( "Data//snd//0.wav" );

(Plus , i replaced ALL "\\" characters with "//")

And now , im getting this only:
Segmentation fault (core dumped)


And here's how the sound init is done:
...if( Mix_OpenAudio( 22050, MIX_DEFAULT_FORMAT, 2, 4096 ) )



[Edited by - 3Dgonewild on March 11, 2007 9:52:16 PM]
Quote:Original post by 3Dgonewild
I compiled the program , but when i double click on "test.o" the screen turns black for a second , and it drops me to the desktop....why is this ?!

The error:

*** Source Snippet Removed ***

[edited]

I did this:
*** Source Snippet Removed ***

And now it shows this:
*** Source Snippet Removed ***

[EDITED.AGAIN]

I replaced
this line:
*** Source Snippet Removed ***
with this one:
*** Source Snippet Removed ***
(Plus , i replaced ALL "\\" characters with "//")

And now , im getting this only:
*** Source Snippet Removed ***

And here's how the sound init is done:
*** Source Snippet Removed ***
Just jumping in here without having read the whole thread, so this may not be relevant, but...

Are you checking the return values of these functions, and using Mix_GetError() where appropriate to log information about any errors that might be occurring?
I don't think it's the problem, but for one thing, (forward-) slashes shouldn't be escaped. Are you sure that Data/snd/0.wav (relative to the current working directory) is a valid WAV file? That is, are you sure that the path is valid and that the file is of the correct format? Remember that the filesystem is case sensitive.

Also, do what jyk said: check the return values of your function calls.

This topic is closed to new replies.

Advertisement