Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 pandaraf   Members   -  Reputation: 108

Like
0Likes
Like

Posted 18 April 2012 - 09:41 AM

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 Posted Image .

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

and

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

and

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--------------------
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)

any suggest? Posted Image

Sponsor:

#2 Waterlimon   Crossbones+   -  Reputation: 2596

Like
1Likes
Like

Posted 18 April 2012 - 09:55 AM

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

o3o


#3 Josh Petrie   Moderators   -  Reputation: 3171

Like
1Likes
Like

Posted 18 April 2012 - 10:38 AM

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

This is correct. Your first bit of code is:

//music
Mix_Music *music = NULL
You're missing the semicolon after the NULL.

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
Mix_Chunk *muks = NULL;
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.

Josh Petrie | Game Developer, Undead Labs


#4 pandaraf   Members   -  Reputation: 108

Like
0Likes
Like

Posted 18 April 2012 - 11:01 AM

Awesome! Thank You Posted Image




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS