Archived

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

darkcoder8

11 errors

Recommended Posts

VC++ keeps giving me 11 errors for some reason. Here they are: Font.cpp The purpose of this code is to make a class out of Nehe''s First Font tutorial: Lesson 13: Bitmap Fonts. 1)error C2144: syntax error : missing '';'' before type ''void'' 2)error C2501: ''WINGDIAPI'' : missing storage-class or type specifiers 3)fatal error C1004: unexpected end of file found Main.cpp 4)syntax error : missing '';'' before ''*'' 5)error C2501: ''g_font'' : missing storage-class or type specifiers 6)error C2227: left of ''->BuildFont'' must point to class/struct/union 7)error C2065: ''cnt1'' : undeclared identifier 8)fatal error C1903: unable to recover from previous error(s); stopping compilation NeHeGL.cpp 9)syntax error : missing '';'' before identifier ''g_isProgramLooping'' 10)''BOOL'' : redefinition; typedef cannot be overloaded with any other symbol 11)fatal error C1004: unexpected end of file found The first 3 errors point to gl.h. The 5th and 6th errors point to:
CFont*		g_font;
 
The 7th error points to:
g_font->BuildFont(-24,0,0,0,FW_BOLD,FALSE,FALSE,FALSE,			          ANSI_CHARSET,	OUT_TT_PRECIS,                   		  CLIP_DEFAULT_PRECIS,	CLIP_DEFAULT_PRECIS, 			  ANTIALIASED_QUALITY,FF_DONTCARE|DEFAULT_PITCH,		  "Courier New");
 
The 8th and 9th errors points to:
glColor3f(1.0f*float(cos(cnt1)),1.0f*float(sin(cnt2)),1.0f-0.5f*float(cos(cnt1+cnt2)));
 
The last error (the BOOL error) points to:
static BOOL g_isProgramLooping;	
 
If you need any of the other code plez ask. Thanks in advance

Share this post


Link to post
Share on other sites
code?

BattleGuard



Only questions raise questions. Questions are raised by people, by curiousity, the gift of nature to all human beings. And curiosity is satisfied by answers, which in turn raise questions, which lead to answers. And this curiosity is what keeps SCIENCE alive...

Share this post


Link to post
Share on other sites
The full code can be found here: (thx to Error404)
http://rafb.net/paste/results/mk312489.html

The rest of the code is NeheGL.cpp|h which can be found on NeHe''s site:
http://www.nehe.gamedev.net



What person?
I forgot what I was gonna say.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You made a very common error. You forgot to put a semicolon at the end of the class declaration.

class CFont
{
....
};

This causes a whole mumbo-jumbo of weird errors, that usually are non-errors but just problems arising from the missing semicolon.

I make this error all the time, but the shitload of errors usually indicates that this is the problem.

MindRazor

Share this post


Link to post
Share on other sites
OK i fixed the thing where it i was doing CFont::GLvoid and i also put that semicolon there. I had brough tit down to 11 errors with the GLvoid thing but with the semicolon there are now 18 errors which are lsited here:

http://rafb.net/paste/results/Y2357840.html

Thanks for all ure help so far.

Share this post


Link to post
Share on other sites
Hehe, nevermind that ;p

int angleofe,
Oh-oh!

hDC
I hope it''s defined in NeHeGL.h -_-, and that the file gets included.

CFont::GLvoid KillFont(GLvoid)
Hello, world!
The return type must go first, like this:
GLvoid CFont::KillFont(GLvoid)
and
int array[*];

Share this post


Link to post
Share on other sites
when the compiler lists lots of errors it''s usually only the first one that is important. Once it''s been tripped up by one syntax error a whole raft of others will follow (which aren''t really errors) and will be ''solved'' just by fixing what''s causing the first error.

Share this post


Link to post
Share on other sites
Leffe is saying that you have defined a variable in you class (int), called "angleofe".

What is worse is that you also have methods within the same class that have parameter lists containing the SAME KEYWORD. This is dangerous and leads to confusion, leading to problems.

Of course this will not cause an error (maybe a warning), but its bad practice and makes your tricky to read.

www.cppnow.com

Share this post


Link to post
Share on other sites
ok i found out that one of my vars was misspelled:
angleofe was spelled angleof that elminated a few errors and then i changed all the GLvoid''s to void''s for simplicity''s sake and that took off a few errors. I alos included stdio.h and math.h for vsprintf and a few other functions to be able to write stuff to the screen and that took away a few errors as well. Finally i also redeclared all the variables in one of nehe''s typedef structs (hDC,hWnd,etc) in my font.h and that got rid of a few more errors.
So in summary, I went from 18 errors to 10 errors and 2 warnings.
Here is the new error summary and it would be great if i could get rid of all the rest of the errors. Thx:

http://rafb.net/paste/results/wa183163.html
Hopefully someone''ll be able to help me or ill be able to help myself
Thanks again and in advance,
darkcoder8



What person?
I forgot what I was gonna say.

Share this post


Link to post
Share on other sites