• Advertisement
Sign in to follow this  

Need Help : error: syntax error before `*' token

This topic is 2101 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Until this topic posted, i didn't found the solution. This thing made me told there's something wrong in the MinGW Developer Studio. Or perharps, it's only my depression [img]http://public.gamedev.net//public/style_emoticons/default/blink.png[/img] .

This is the codes i wrote :
[CODE]
//music
Mix_Music *music = NULL
//additional musics
Mix_Chunk *muks = NULL;
Mix_Chunk *music2 = NULL;
Mix_Chunk *music3 = NULL;
Mix_Chunk *music4 = NULL;
[/CODE]

and

[CODE]
void clean() {
Mix_HaltMusic();
Mix_FreeMusic( music );
Mix_FreeChunk( muks );
Mix_FreeChunk( music2 );
Mix_FreeChunk( music3 );
Mix_FreeChunk( music4 );
Mix_CloseAudio();
[/CODE]

and

[CODE]
bool load_files() {
music = Mix_LoadMUS( "vq.wav" );
if( music == NULL ) { return false; }

muks = Mix_LoadWAV( "01.wav" );
music2 = Mix_LoadWAV( "02.wav" );
music3 = Mix_LoadWAV( "03.wav" );
music4 = Mix_LoadWAV( "04.wav" );
if( ( muks == NULL ) || (music2 == NULL ) || (music3 == NULL ) || (music4 == NULL ) ) { return false; }
[/CODE]

then, the error was :
[CODE]
--------------------Configuration: my project - Debug--------------------
Compiling...
ini.cpp
ini.cpp:21: error: syntax error before `*' token
ini.cpp: In function `bool load_files()':
ini.cpp:223: error: `muks' undeclared (first use this function)
ini.cpp:223: error: (Each undeclared identifier is reported only once for each
function it appears in.)
ini.o - 3 error(s), 0 warning(s)
[/CODE]

any suggest? [img]http://public.gamedev.net//public/style_emoticons/default/mellow.png[/img]

Share this post


Link to post
Share on other sites
Advertisement
[quote name='Waterlimon' timestamp='1334764503' post='4932501']
You forgoet a ";" from first line of code.
[/quote]
This is correct. Your first bit of code is:

[color=#880000]//music[/color]
[color=#660066]Mix_Music[/color][color=#000000] [/color][color=#666600]*[/color][color=#000000]music [/color][color=#666600]=[/color][color=#000000] NULL[/color]
[color="#000000"]You're missing the semicolon after the NULL.[/color]

[color="#000000"]Sometimes, when you see an error from a compiler and it points to a line that looks okay -- in this case, it's probably indicating the line[/color]
[color=#660066]Mix_Chunk[/color][color=#000000] [/color][color=#666600]*[/color][color=#000000]muks [/color][color=#666600]=[/color][color=#000000] NULL[/color][color=#666600];[/color]
which looks fine, you should take a look at the line (or the code) above the error. The C++ compiler processes code from the top down and certain errors confuse the parse enough that it cannot pinpoint the source of the error with complete accuracy.

Share this post


Link to post
Share on other sites
Awesome! Thank You [img]http://public.gamedev.net//public/style_emoticons/default/biggrin.png[/img]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement