• Advertisement
Sign in to follow this  

I am baffled, what could I be doing wrong?

This topic is 3673 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

#include <allegro.h> #include <cstdlib> #include <time.h> #define edeadplace 250 #define pdeadplace 70 #define p 100 #define e 540 #define y 240 #define center 320 srand(time(NULL)); //error line I am totally baffled! This is only the first few lines of my program, and I already have an error! "Expected constructor, destructor, or type conversion before '(' token" "Expected ',' or ';' before '(' token" What could I be doing wrong? I have done srand correctly as in my for dummies book. What could it be? Btw, almost all lines lines after this have the exact same error.

Share this post


Link to post
Share on other sites
Advertisement
I think because you are trying to call the function outside the scope of main, the compiler thinks it is a function or class declaration. Try moving the srand call into main.

Share this post


Link to post
Share on other sites
Move srand() into your main function and it should work.

Edit: Link3333 beat me to it :(

Share this post


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

  • Advertisement