-
SDL error
Every time I try to compile a file that uses SDL, I get the following error:
In file included from C:\DEV-C_~1\Include\sdl.h:39,
from c:\documents and settings\owner\my documents\c++\keypresstest.cpp:1:
C:\DEV-C_~1\Include\SDL_audio.h:97: parse error before `['
Any idea what's up?
I'm using Dev-c++ v4, btw.
-
Post some related code please, I can't deduce the problem from that very limited amount of information.
-
Code:
#include <SDL.h>
int main(int argc, char *argv[])
{
return 0;
}
-
This is a known parsing error with certain versions of gcc I believe. I googled for it, and i encourage you to do the same, and came up with two fixes:
1) Downgrade to SDL 1.2.7, it compiles fine.
2) Or keep 1.2.8 and edit the SDL_audio.h, line 97 to make it work with g++
You only need to change:
void (SDLCALL *filters [10])(struct SDL_AudioCVT *cvt, Uint16 format);
to:
void (*filters [10])(struct SDL_AudioCVT *cvt, Uint16 format);
-
Er, I mean, getting different errors.
C:\DEV-C_~1\Lib\\libsdl.a(SDL_systimer.o): In function `SDL_StartTicks':
/home/hercules/release/SDL-1.2.8/src/timer/SDL_systimer.c:73: undefined reference to `timeBeginPeriod@4'
/home/hercules/release/SDL-1.2.8/src/timer/SDL_systimer.c:74: undefined reference to `timeGetTime@0'
C:\DEV-C_~1\Lib\\libsdl.a(SDL_systimer.o): In function `SDL_GetTicks':
/home/hercules/release/SDL-1.2.8/src/timer/SDL_systimer.c:101: undefined reference to `timeGetTime@0'
C:\DEV-C_~1\Lib\\libsdl.a(SDL_systimer.o): In function `SDL_SYS_TimerInit':
/home/hercules/release/SDL-1.2.8/src/timer/SDL_systimer.c:189: undefined reference to `timeBeginPeriod@4'
/home/hercules/release/SDL-1.2.8/src/timer/SDL_systimer.c:195: undefined reference to `timeSetEvent@20'
C:\DEV-C_~1\Lib\\libsdl.a(SDL_systimer.o): In function `SDL_SYS_TimerQuit':
/home/hercules/release/SDL-1.2.8/src/timer/SDL_systimer.c:208: undefined reference to `timeEndPeriod@4'
/home/hercules/release/SDL-1.2.8/src/timer/SDL_systimer.c:206: undefined reference to `timeKillEvent@4'
/home/hercules/release/SDL-1.2.8/src/timer/SDL_systimer.c:208: undefined reference to `timeEndPeriod@4'
Here's the first fifth or so of the error log. I tried googling stuff on that. The only page I could get was in french.
-