Sign in to follow this  
Dom_152

Ooo Annoying Errors

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
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
http://landsofasronia.50webs.com/main.cpp
http://landsofasronia.50webs.com/Bitmap%20Object.h
http://landsofasronia.50webs.com/Bitmap%20Object.cpp

Those are the files I have uploaded to my web space.

[Edited by - Dom_152 on March 15, 2006 1:28:13 AM]

Share this post


Link to post
Share on other sites
If you'd like a newer compiler that has all those cool features that VC++ 6 is lacking, I'd recommend VC++ 2005 Express. It's free on microsoft's website. Just go to their main page, and navigate to their developer section. From there, you should be able to find links to their "Express"-edition compilers

Share this post


Link to post
Share on other sites
Ok the migration to 2005 didn't go to well. 24 Errors and 8 warnings. And here they are in all their glory:

------ Build started: Project: Sky Blocks, Configuration: Debug Win32 ------
Compiling...
Bitmap Object.cpp
c:\program files\microsoft visual studio 8\vc\include\winnt.h(3035) : warning C4103: 'c:\program files\microsoft visual studio 8\vc\include\winnt.h' : alignment changed after including header, may be due to missing #pragma pack(pop)
c:\program files\microsoft visual studio 8\vc\include\winnt.h(3327) : warning C4103: 'c:\program files\microsoft visual studio 8\vc\include\winnt.h' : alignment changed after including header, may be due to missing #pragma pack(pop)
c:\program files\microsoft visual studio 8\vc\include\winnt.h(3423) : warning C4068: unknown pragma
c:\program files\microsoft visual studio 8\vc\include\winnt.h(3428) : warning C4068: unknown pragma
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1252) : error C2144: syntax error : 'void' should be preceded by ';'
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1252) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1253) : error C2144: syntax error : 'void' should be preceded by ';'
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1253) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1253) : error C2086: 'int DECLSPEC_NORETURN' : redefinition
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1252) : see declaration of 'DECLSPEC_NORETURN'
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1313) : error C2144: syntax error : 'void' should be preceded by ';'
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1313) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1313) : error C2086: 'int DECLSPEC_NORETURN' : redefinition
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1252) : see declaration of 'DECLSPEC_NORETURN'
main.cpp
c:\program files\microsoft visual studio 8\vc\include\winnt.h(3035) : warning C4103: 'c:\program files\microsoft visual studio 8\vc\include\winnt.h' : alignment changed after including header, may be due to missing #pragma pack(pop)
c:\program files\microsoft visual studio 8\vc\include\winnt.h(3327) : warning C4103: 'c:\program files\microsoft visual studio 8\vc\include\winnt.h' : alignment changed after including header, may be due to missing #pragma pack(pop)
c:\program files\microsoft visual studio 8\vc\include\winnt.h(3423) : warning C4068: unknown pragma
c:\program files\microsoft visual studio 8\vc\include\winnt.h(3428) : warning C4068: unknown pragma
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1252) : error C2144: syntax error : 'void' should be preceded by ';'
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1252) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1253) : error C2144: syntax error : 'void' should be preceded by ';'
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1253) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1253) : error C2086: 'int DECLSPEC_NORETURN' : redefinition
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1252) : see declaration of 'DECLSPEC_NORETURN'
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1313) : error C2144: syntax error : 'void' should be preceded by ';'
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1313) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1313) : error C2086: 'int DECLSPEC_NORETURN' : redefinition
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1252) : see declaration of 'DECLSPEC_NORETURN'
c:\documents and settings\owner\desktop\tetris clone\sky blocks\main.cpp(57) : error C2146: syntax error : missing ';' before identifier 'BMap'
c:\documents and settings\owner\desktop\tetris clone\sky blocks\main.cpp(57) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\documents and settings\owner\desktop\tetris clone\sky blocks\main.cpp(57) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\documents and settings\owner\desktop\tetris clone\sky blocks\main.cpp(57) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\documents and settings\owner\desktop\tetris clone\sky blocks\main.cpp(107) : error C2664: 'BitBlt' : cannot convert parameter 6 from 'int' to 'HDC'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
c:\documents and settings\owner\desktop\tetris clone\sky blocks\main.cpp(196) : error C2228: left of '.Create' must have class/struct/union
type is 'int'
c:\documents and settings\owner\desktop\tetris clone\sky blocks\main.cpp(197) : error C2664: 'FillRect' : cannot convert parameter 1 from 'int' to 'HDC'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
c:\documents and settings\owner\desktop\tetris clone\sky blocks\main.cpp(200) : error C2228: left of '.Load' must have class/struct/union
type is 'int'
Generating Code...
Build log was saved at "file://c:\Documents and Settings\Owner\Desktop\Tetris Clone\Sky Blocks\Debug\BuildLog.htm"
Sky Blocks - 24 error(s), 8 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Share this post


Link to post
Share on other sites
Since I didn't have access to the complete source, I simply created my own BitmapObject class to satisfy the compiler's errors, and created empty functions for the missing functions, and it compiled without errors.

Share this post


Link to post
Share on other sites
Quote:
Original post by Dom_152
Heh, yeah I downladed that once but I was told it was missing some include files or some libraies? Well I'll try it again.

it just needs the platform sdk. (i believe it also lacks mfc and atl, but i don't use those anyway)
Using Visual C++ 2005 Express Beta 2 with the Microsoft Platform SDK

edit: didn't somebody here code something to configure this a while ago? i don't understand why microsoft didn't make the configuration on that page automatic when they released it. not that it's hard to do, but it's somewhat annoying.

Share this post


Link to post
Share on other sites
OK I think i'm jsut gonna stick to VC++ 6 for now. 2005 is more trouble then it's worth. So I'll check those links I put up earlier and see what's up.
EDIT: All the links now work.

Share this post


Link to post
Share on other sites
Using your source code, it all still compiles for me without error, and this is using the default project settings so you probably have a typo in your source code, or simply a corrupt project. Try cleaning and then compiling.

Share this post


Link to post
Share on other sites
Right I have re-created an Empty Win32 Project over and Over again and I have checked for missing ;s and typos and I see nothing. ARGH I hate it when this happens!

Share this post


Link to post
Share on other sites
Ok, you know, I just noticed one thing I added to your code to get it to compile. I had to add the include for "Bitmap Object.h" since it was not present in main.cpp.

Share this post


Link to post
Share on other sites
Ha, lol why didn't I try that? Well it's got rid of those errors but guess what!? It's giving me more errors but they seem to be associated with building DLLs and/or Librarie files or some other external dependancy file. I'm probably wrong but here are those errors. thanks for the tip btw :D

main.obj : error LNK2001: unresolved external symbol "void __cdecl RotateBlock(void)" (?RotateBlock@@YAXXZ)
main.obj : error LNK2001: unresolved external symbol "void __cdecl Move(int,int)" (?Move@@YAXHH@Z)
main.obj : error LNK2001: unresolved external symbol "void __cdecl DrawMap(void)" (?DrawMap@@YAXXZ)
main.obj : error LNK2001: unresolved external symbol "void __cdecl NewBlock(void)" (?NewBlock@@YAXXZ)

EDIT: Fixed. It was because I was using functions that had been prototyped but not actually created. I just commented out the calls to thos efunctions temporaily and boom. Thanks for the help people. I'm enjoying my stay so far.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this