Parse error in SDL_audio.h using g++ and -mno-cygwin

please forgive me if i’m rehashing something that as already been covered
and addressed, but i’m both new to SDL and revisiting C/C++ after a long
soujourn with Java.

what i’m aiming to do is compile a C++ application with [-mno-cygwin].
unforunately, this results in the following error:

/usr/local/include/SDL/SDL_audio.h:97: error: parse error before `[’ token

it is one that is easily reproducable, as follows:

$ g++ -I/usr/local/include/SDL -c loopwave.c -mno-cygwin
In file included from /usr/local/include/SDL/SDL.h:39,
from loopwave.c:12:
/usr/local/include/SDL/SDL_audio.h:97: error: parse error before `[’ token

without the -mno-cygwin option the compilation completes successfully:

marc at marcd /home/marc/wip
$ g++ -I/usr/local/include/SDL -c loopwave.c

marc at marcd /home/marc/wip

googling for this error (is there an easy way to search the mail archive?)
led me to a posting reporting the same error, and a response from mr.
lantinga:

Sam Lantinga wrote:

When trying to compile wsing mingw c++ i get:

SDL/SDL_audio.h:97: parse error before `[’ token

Just remove SDLCALL from that line. It’s a parser bug in gcc.

Really ? IIRC __cdecl it just comes with #include <windows.h> in mingw.
Maybe it should just be fixed in begin_code.h
The bug is in the parsing of the declaration of an array of function pointers
in conjunction with SDLCALL.
See ya!
-Sam Lantinga, Software Engineer, Blizzard Entertainment

i assume that this means there’s a bug in the g++ parser, but is there any
workaround? can i achieve a C++ build using -mno-cygwin?

any help would be greatly appreciated.
.marc

I have managed to compile by changing that line to this:

    void (SDLCALL **filters)(struct SDL_AudioCVT *cvt, Uint16 format);

Hope it helps :)On Wed, 9 Mar 2005 15:01:19 +0200 “Marc Daya” <Marc.Daya at s1.com> wrote:

i assume that this means there’s a bug in the g++ parser, but is there any
workaround? can i achieve a C++ build using -mno-cygwin?


Saludos,
STenyaK


Site: http://kwh.iespana.es
http://motorsport-sim.org
http://bashekas.v29.net <1kSurvivor>
Mail: stenyak AT gmx DOT net

please forgive me if i’m rehashing something that as already been covered
and addressed, but i’m both new to SDL and revisiting C/C++ after a long
soujourn with Java.

what i’m aiming to do is compile a C++ application with [-mno-cygwin].
unforunately, this results in the following error:

/usr/local/include/SDL/SDL_audio.h:97: error: parse error before `[’ token

As I wrote a few days ago I’ve got the same problem upgrading from SDL
1.2.7 to 1.2.8 and compiling against MinGW 3.3.1 with Dev-Cpp.


Comparing SDL_audio.h version 1.2.8 to previous 1.2.7 I found that the only
difference on line 97 is:

(1.2.8) void (SDLCALL *filters[10])(struct SDL_AudioCVT *cvt, Uint16

format);

(1.2.7) void ( *filters[10])(struct SDL_AudioCVT *cvt, Uint16 format);

deleting “SDLCALL” in 1.2.8 all seems to work fine… …but why?!

Again: I don’t know why, by this work.

elhja