tags:

views:

80

answers:

3

I am trying to build a Visual C++ 2008 DLL using SDL_Mixer 1.2:

http://www.libsdl.org/projects/SDL_mixer/

This is supposedly from a build made for Visual C++, but when I include SDL_mixer.h I get error C2143: "syntax error : missing ';' before '['".

The problem line is:

const char[] MIX_EFFECTSMAXSPEED = "MIX_EFFECTSMAXSPEED";

Is this because of the use of the dynamic array construct "char[]", instead of "char*"?

All the expressions in the file are wrapped by "extern "C" {".

+5  A: 

move the square brackets after the variable name

const char MIX_EFFECTSMAXSPEED[] = "MIX_EFFECTSMAXSPEED";
KPexEA
Weird that it was the way it was, since this is presumably a package that others use, and the language type is definitely defined as "C".
Buggieboy
+3  A: 

You want:

const char MIX_EFFECTSMAXSPEED[] = "MIX_EFFECTSMAXSPEED";

Note that there is no "dynamic array construct" here - you have an array of char that is initialised witha string literal - all compile time things.

anon
Thanks. Guess I'll have to change the distribution header. Yuch.
Buggieboy
A: 

My bad. Although the answers here are correct regarding C construct, the actual problem was that I had included a "D" language file instead of the C version.

Buggieboy