#### Archived

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

# 11 errors

This topic is 5349 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 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 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 on other sites
Looks like you forgot to include windows.h. Be sure to include it BEFORE gl.h as well.

##### Share on other sites
Thx but when i do that it changes teh redefined bool to redefinition of GLVOID and gives me 12 errors instead of 11...

What person?
I forgot what I was gonna say.

##### Share on other sites
But then what are these new 12 errors?

you NEED windows.h, no question there.

www.cppnow.com

##### Share on other sites
The new 12 errors are listed here:

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

##### Share on other sites
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 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 on other sites
Seems like you need to include some header with some random global variables, include all headers in your project and it might work ^_ ^

##### Share on other sites
wat do u mean? i included the header in that link above and the nehegl.h is on nehes site.

##### 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 on other sites
I took care of all that.
And wat do u mean by this:

quote:

int angleofe,
Oh-oh!

##### 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 on other sites
quote:
And wat do u mean by this:

Take a close look, something is bold Remove it.

##### 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 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
darkcoder8

What person?
I forgot what I was gonna say.

##### Share on other sites
This is getting nuts.. concidered rewriting the code from scratch, compiling frequently?

This way you will also learn its architecture, and how it runs.

www.cppnow.com

##### Share on other sites
yah i think im gonna do that. damn waste of time is wat it is but thx to all! very helpful anwyay.

-darkcoder8

What person?
I forgot what I was gonna say.