# SDL error...

This topic is 4905 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello, i just set up SDL and SDL_image for DevC++, but even when i try to compile the example it comes with i get this error, In file included from C:/Dev-Cpp/include/SDL/SDL.h:39, C:\Dev-Cpp\include\SDL\SDL_audio.h syntax error before [' token when i open that file the error is on line "void (SDLCALL *filters[10])(struct SDL_AudioCVT *cvt, Uint16 format);" i didnt edit any of the files or anything, am i missing a Devpack or somthing?, oh and i have both the .dll files in the programs home directory, any ideas? thanks in advanced

##### Share on other sites
Take out the 'SDLCALL' it is a known error with Dev-CPP. I usually just comment out that entire line to make life easier.

##### Share on other sites
Quote:
 Original post by Drew_BentonTake out the 'SDLCALL' it is a known error with Dev-CPP. I usually just comment out that entire line to make life easier.

ah ok, thanks :P

##### Share on other sites
err ok one more thing :D now while im compiling i get this following,

[Linker error] undefined reference to SDL_FreeSurface'

why is this? im sorry if this is a really simple question, but im a noob :P

##### Share on other sites
Not a problem you need to link in the libraries:
-lmingw32-lsdlmain-lsdl

This can be done by going to Project->Project Options->Parameters and add them to the linker box. Have a look at these tutorials as well. They show some good basics to get up and runnig with SDL, including a small game. You can also find game tutorials here.

- Drew

##### Share on other sites
IMG_Load is provided by SDL_image, you'll need to link with that as well. So add -lSDL_image to that list.

As for the line with the error, _don't_ remove it, that will change the size of the struct and the offset of some of the members. Remove STDCALL instead.

##### Share on other sites
Quote:
 Original post by jonahrowleyAs for the line with the error, _don't_ remove it, that will change the size of the struct and the offset of some of the members. Remove STDCALL instead.

Ahh yes, you are right. It is a good idea not to remove it, my mistake, especially if you are going to be using audio [lol]. Then your SDL mixer would have died and you would have had no idea. I better take note of that so I can remember next time.

- Drew

##### Share on other sites
Quote:
Original post by Drew_Benton
Quote:
 Original post by jonahrowleyAs for the line with the error, _don't_ remove it, that will change the size of the struct and the offset of some of the members. Remove STDCALL instead.

Ahh yes, you are right. It is a good idea not to remove it, my mistake, especially if you are going to be using audio [lol]. Then your SDL mixer would have died and you would have had no idea. I better take note of that so I can remember next time.

- Drew

oh ok, thank you :D

Edit: ok umm...what line was that on? i just removed it i think, since i cant seem to find it anymore :P

##### Share on other sites
Ok open up "SDL_audio.h". From line 86-99 this is what it is supposed to be.

/* A structure to hold a set of audio conversion filters and buffers */typedef struct SDL_AudioCVT {	int needed;			/* Set to 1 if conversion possible */	Uint16 src_format;		/* Source audio format */	Uint16 dst_format;		/* Target audio format */	double rate_incr;		/* Rate conversion increment */	Uint8 *buf;			/* Buffer to hold entire audio data */	int    len;			/* Length of original audio buffer */	int    len_cvt;			/* Length of converted audio buffer */	int    len_mult;		/* buffer must be len*len_mult big */	double len_ratio; 	/* Given len, final size is len*len_ratio */	void (*filters[10])(struct SDL_AudioCVT *cvt, Uint16 format);	int filter_index;		/* Current audio conversion function */} SDL_AudioCVT;

Line 97 used to be this:
void (SDLCALL *filters[10])(struct SDL_AudioCVT *cvt, Uint16 format);`

- Drew

1. 1
2. 2
Rutin
22
3. 3
4. 4
JoeJ
16
5. 5

• 14
• 29
• 9
• 11
• 11
• ### Forum Statistics

• Total Topics
631775
• Total Posts
3002278
×