Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

merwin

unexpected class??

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

Hello If I try to compile my program (with visual c++ 6)I get the following errors serveral times: error C2236: unexpected ''class'' error C2143: syntax error : missing '';'' before ''PCH creation point'' I can''t find any error in my source related to this..

Share this post


Link to post
Share on other sites
Advertisement
looks like two things:
- you''re defining the files to use pre-compiled headers, but your pre-compiled header is not the first #include in the file.
- you might be calling your files something.c, which makes MSVC compile them as C files, not as C++ files. Rename them something.cpp.

Share this post


Link to post
Share on other sites
sounds like your trying to define a class before including the PreCompiled Header

ie make sure that the first line of code in all your cpp files is

#include "StdAfx.h"

that should do the trick!!

Paul.

Edited by - Spider_In_A_Web on October 30, 2001 11:33:34 AM

Share this post


Link to post
Share on other sites
I got this exact message a couple days ago, and it turned out to be caused by a missing semi-colon, of all things. I know VC++ has a habit of issuing error messages that aren''t related to the actual error, so it may just be me...

''Nuff said. I''ll enjoy watching you live, demon.

Share this post


Link to post
Share on other sites
Mayrel: that''s a good point. The parser separates statements by braces, semicolons or other syntax-dependent separators. Therefore, it''s always a good idea to handle errors from the top of the file - they often clear up errors further down.

Share this post


Link to post
Share on other sites
Sorry to revive an old thread, but this problem has been bugging me lately, and I hope some more light can be shed upon it. I get the same "unexpected class" error, but this time it''s in the header, not the source. I have no errors before this one, and for some reason, even when I only include the h file once (with multiple inclusion guards), it still gives me "unexpected class"

quote:
Spider_In_A_Web
make sure that the first line of code in all your cpp files is #include "StdAfx.h"



Erm.. what if I don''t have any "StdAfx.h" file?

Anyway, what on earth could the problem be? I declare my class like this:

class CRenderer
{
stuff
};

so what is so Unexpected about it?

Anye help would be appreciated,

freshya

Share this post


Link to post
Share on other sites

  • 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!