DevCpp und SDL - C compiliert, C++ nicht ?
-
HAllo,
ich lern grad mit der SDL laufen.
Leider hab ich scheinbar nen Problem mit dem Compiler..Wenn ich ein Projekt als C++ compile bringt er mir Fehler :
3 C:\Dev-Cpp\include\SDL\SDL.h:39, from main.cpp In file included from C:/Dev-Cpp/include/SDL/SDL.h:39, from main.cpp
97 C:\Dev-Cpp\include\SDL\SDL_audio.h syntax error before `[' token
C:\daten\programmierung\withSDL\test2\Makefile.win [Build Error] [main.o] Error 1Die entsprechende Zeile lautet wie folgt :
void (SDLCALL *filters[10])(struct SDL_AudioCVT *cvt, Uint16 format);
Nutze ich C, gehts..
Kann mir wer erklären warum und wie ich's repariere?
-
der fehler rührt wohl hier her (denk ich)
/* By default SDL uses the C calling convention */ #ifndef SDLCALL #ifdef WIN32 #define SDLCALL __cdecl #else #define SDLCALL #endif #endif /* SDLCALL */
welche sdl version hast du?
mein header 1.2.4 sieht so aus, dieser geht sowohl mit c als auch mit cpp
[cpp]
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;
[/cpp]
-
Hab die SDL 1.2.8.
Hab jetzt mal den SDLCALL rausgenommen.
Jetzt gehts.hab mal etwas weiter geforscht. Das soll wohl nen Problem des MinGW in der Version sein, die im DevCpp 4.9.9.1 bei ist. Wenn dort ne neue Version mitgelifert wird, ist das Problem hinfällig.
thx