[SDL] parse error in SDL_audio.h using g++ and -mno-cygwin

Marc Daya Marc.Daya at s1.com
Wed Mar 9 05:01:19 PST 2005


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




More information about the SDL mailing list