Jump to content
  • Advertisement
Sign in to follow this  
Dom_152

Ooo Annoying Errors

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

Ok I have a fwe problems. I was following a tutorial on these forums on how to create a Tetris style game. And I was just building my project when I got these errors: --------------------Configuration: Sky Blocks - Win32 Debug-------------------- Compiling... main.cpp C:\Documents and Settings\Owner\Desktop\Tetris Clone\Sky Blocks\main.cpp(58) : error C2146: syntax error : missing ';' before identifier 'BMap' C:\Documents and Settings\Owner\Desktop\Tetris Clone\Sky Blocks\main.cpp(58) : error C2501: 'BitmapObject' : missing storage-class or type specifiers C:\Documents and Settings\Owner\Desktop\Tetris Clone\Sky Blocks\main.cpp(58) : fatal error C1004: unexpected end of file found Error executing cl.exe. main.obj - 3 error(s), 0 warning(s) Coming from this piece of code: //Structures //This is a structure for shapes struct Shape { int size [4] [4]; int x, y; }; Shape PrevShape; //Uses the Shape structure to create a preview shape to show what shapes next Shape CurrentShape; //Uses the Shape structure to create the current shape being controlled by the player DWORD start_time; //Used for timing bool GameStart = FALSE; //Lets the program know if the game has started //We create two Bitmap Objects using our class. One to handle the whol map (Static Block Array) and one for the current blocks BitmapObject BMap, BBlocks; //Map and Blocks Then... --------------------Configuration: Sky Blocks - Win32 Debug-------------------- Compiling... main.cpp C:\Documents and Settings\Owner\Desktop\Tetris Clone\Sky Blocks\main.cpp(51) : error C2146: syntax error : missing ';' before identifier 'PrevShape' C:\Documents and Settings\Owner\Desktop\Tetris Clone\Sky Blocks\main.cpp(51) : fatal error C1004: unexpected end of file found Error executing cl.exe. main.obj - 2 error(s), 0 warning(s) Which I get after adding a ; (Semi-colon) to the Shape Structure I don't quite understand whats going on. Anybody fancy helping me? Thanks in advance. Oh and if you need to see any classes or anything like that just ask.

Share this post


Link to post
Share on other sites
Advertisement
Double-check and make sure you are putting semicolons at the end of each class (much like with your struct)

ex:

class Foo
{

//stuff
}; //<--BLAM! Semicolon -- right there.

Also, you may have to check EVERYTHING above your line of code that generates the error, including any files (that you created) that are included at the top. Sometimes a compiler can catch an error that actually was caused by code that was written a few lines ABOVE where it thinks the error is.

ex: #include "myfile.h" //<-- check the bottom-most lines of code in this file.

Share this post


Link to post
Share on other sites
Quote:
C:\Documents and Settings\Owner\Desktop\Tetris Clone\Sky Blocks\main.cpp(51) : fatal error C1004: unexpected end of file found


You're missing a closing brace } somewhere.

Share this post


Link to post
Share on other sites
Thanks for the quick replys, there is definatly the semi-colon at the end of my class and I shall check my BitmapObject.h file. And I know that the un-expected end of file emans there is mising a closing brace i just don't know where :S

Share this post


Link to post
Share on other sites
The newer IDEs have a really helpful feature: whenever you type a closing brace, it will make it BOLD, as well as the corresponding opening brace. This makes it a lot easier for you to hunt for matching opening/closing braces.

Share this post


Link to post
Share on other sites
Hmm I don't think VC++ 6 has this feature, if it doesn can anyone tell me how to get it working? And I still cant seem to find the solutions to anything! 'Tis annoying lol. I think I should mention that my main.cpp does not include any of my "home-made" header files. However BitmapObject.cpp includes my BitmapObject.h file but BitmapObject.cpp compiles fine.

Share this post


Link to post
Share on other sites
That error can also be caused by having the project set to use a precompiled header, but then you failing to include it in your source code.

Share this post


Link to post
Share on other sites
Then in fact that is probably it. MSVC++ by default tends to enable precompiled headers. At least, that has been my experience.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!