Jump to content
  • Advertisement
Sign in to follow this  

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

This topic is 2377 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 blink.png .

This is the codes i wrote :

Mix_Music *music = NULL
//additional musics
Mix_Chunk *muks = NULL;
Mix_Chunk *music2 = NULL;
Mix_Chunk *music3 = NULL;
Mix_Chunk *music4 = NULL;


void clean() {
Mix_FreeMusic( music );
Mix_FreeChunk( muks );
Mix_FreeChunk( music2 );
Mix_FreeChunk( music3 );
Mix_FreeChunk( music4 );


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; }

then, the error was :

--------------------Configuration: my project - Debug--------------------
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)

any suggest? mellow.png

Share this post

Link to post
Share on other sites

You forgoet a ";" from first line of code.

This is correct. Your first bit of code is:

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

[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=#660066]Mix_Chunk[color=#000000] [color=#666600]*[color=#000000]muks [color=#666600]=[color=#000000] NULL[color=#666600];
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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!