Sign in to follow this  
StoneMask

Hundreds of "Identifier not found" errors

Recommended Posts

So I'll copypaste all my code and the errors I'm getting. There are a massive amount of errors, and I don't really get it, because I remember I fixed this at some point or another. Essentially, the program is telling me that my class functions and variables don't exist, when they clearly do. I've included the header files and all the necessary stuff, but it's just giving me a ton of errors.

It's divided into eight files, but it runs through these files first. I'll just link two since all the files have similar problems.

[u][b]FINALBOSS.h[/b][/u]
[spoiler][code]
// enemy.h
// houses the enemy class
#ifndef FINALBOSS_H
#define FINALBOSS_H
using namespace std;
class FINALBOSS
{
public:
/* constructors */
FINALBOSS();
/* mutators */
void AddStamina(short alteration);
void AddHitPoints(short alteration);
/* accessors */
short GetStamina();
short GetHitpoints();
short GetPosX();
short GetPosY();
/* Display */
void DisplayFrame1();
void DisplayFrame2();
void DisplayFrame3();
void Screenshake(short speed, short duration);
void DrawStage();
/* movement */
void move_up();
void move_dn();
/* actions */
short Act_Random();
void Act_Idle(short posX, short posY);
void Act_Headbutt();
//void Act_Shoot(Enemy *, short, char);
void launchphase();
private:
HANDLE hOut; // holds window information for the class
string frame1[15];
string frame2[15];
string frame3[15];
short stamina; // the amount of hits it takes to get to launch phase
short dice, // for randomly using attacks
hitpoints; // the actual vitality of the bear
bool isActing; // whether or not the bear has finished an action
unsigned short timer; // times when the bear does things
COORD pos; // stores FINALBOSS' position
COORD defaultPos; // boss' resting coordinates
};
#endif
[/code][/spoiler]

[u][b]FINALBOSS.cpp[/b][/u]
[spoiler][code]
// FINALBOSS.cpp
// houses all the functions of the FINALBOSS class
#include <iostream>
#include <ctime>
#include <string>
#include <Windows.h>
#include "game.h"
#include "FINALBOSS.h"
#include "enemy.h"
/* constructors */
FINALBOSS::FINALBOSS():
stamina(1000),
hitpoints(3)
{
hOut = GetStdHandle(STD_OUTPUT_HANDLE);
srand(time(0));
isActing = false;
COORD dice;
pos.X = 52;
pos.Y = 6;
defaultPos.X = pos.X;
defaultPos.Y = pos.Y;
dice.X = rand() % 3 + 1;
for(short i = 0, j = 5; i < 300; i++)
{
switch(dice.X)
{
case 1:
dice.X = rand() % 80 + 1;
dice.Y = rand() % 25 + 1;
SetConsoleCursorPosition(hOut, dice);
cout << BIG_STAR;
break;
case 2:
dice.X = rand() % 80 + 1;
dice.Y = rand() % 25 + 1;
SetConsoleCursorPosition(hOut, dice);
cout << POP_STAR;
break;
case 3:
dice.X = rand() % 80 + 1;
dice.Y = rand() % 25 + 1;
SetConsoleCursorPosition(hOut, dice);
cout << SMALL_STAR;
break;
default:
break;
} dice.X = rand() % 3 + 1;
Sleep(j); if (j % 2 == 0) j++;
}
frame1[0] = " ";
frame1[1] = " ____ ";
frame1[2] = " /( )|___ ";
frame1[3] = " / |\\\\\\ ";
frame1[4] = " /| ///||\\\\\\\\\\ ";
frame1[5] = " /| ////||||\\\\\\\\\\\\\\ ";
frame1[6] = " | ||||||||||||\\\\\\\\| ";
frame1[7] = " | |||||||||||\\\\\\\\\\\\| ";
frame1[8] = " | \\\\\\\\\\||||||||\\\\\\;;\\ ";
frame1[9] = " |||||::||||||///;;;;/ ";
frame1[10] = " |\\;( );|||;;;;;;;;;/ ";
frame1[11] = " \\\\;;::;;;;;;;;;;;;/ ";
frame1[12] = " | |///- -,//;;;/ ";
frame1[13] = " \\__//;;- -/+/ ";
frame1[14] = " ";
frame2[0] = " ";
frame2[1] = " ___ ";
frame2[2] = " ______/ \\ ";
frame2[3] = " / ====== ( )/, ";
frame2[4] = " // +========; \\, ";
frame2[5] = " / ::~=========; \\, ";
frame2[6] = " _/ :( ):========= ;;\\, ";
frame2[7] = " / |==::========= ;;;| ";
frame2[8] = " \\ / __=========== ;;;/ ";
frame2[9] = " \\| \\| ========;;;;;/ ";
frame2[10] = " |========;;;;/ ";
frame2[11] = " |\\|\\/========;;;;/ ";
frame2[12] = " ===,/;;;;;;;;; ";
frame2[13] = " ";
frame2[14] = " ";
frame3[0] = " ";
frame3[1] = " _ , ,,,,,,, ____ ";
frame3[2] = " / \\ ;;;=:::====/ \\ ";
frame3[3] = " \\_/===;( );==== ( ) | ";
frame3[4] = " | =====:::====== ;/ ";
frame3[5] = " \\---==___========= ;| ";
frame3[6] = " \\|;\\|;;;\\====== ;;;| ";
frame3[7] = " ;;;;;;\\===== ;;| ";
frame3[8] = " ;;;;;;\\==== ;;/ ";
frame3[9] = " ;;;;; |=== ;;;;/ ";
frame3[10] = " ;;;;/== ;;;;/ ";
frame3[11] = " |\\;|\\.;;;;;;;/ ";
frame3[12] = " +;;;;;;;;;// ";
frame3[13] = " ''''''''' ";
frame3[14] = " ";
DisplayFrame1();
Sleep(2000);
DisplayFrame2();
Sleep(2000);
DisplayFrame3();
Sleep(10);
Screenshake(10, 150);
DrawStage();
}
/* mutators */
void FINALBOSS::AddStamina(short alteration)
{
stamina += alteration;
}
void FINALBOSS::AddHitPoints(short alteration)
{
hitpoints += alteration;
}
/* accessors */
short FINALBOSS::GetStamina() {return stamina;}
short FINALBOSS::GetHitpoints() {return hitpoints;}
short FINALBOSS::GetPosX() {return pos.X;}
short FINALBOSS::GetPosY() {return pos.Y;}
/* Display */
void FINALBOSS::DisplayFrame1()
{
for (short i = 0; i < 15; i++)
{
SetConsoleCursorPosition(hOut, pos);
cout << frame1[i];
pos.Y++;
} pos.Y -= 15;
}
void FINALBOSS::DisplayFrame2()
{
for(short i = 0; i < 15; i++)
{
SetConsoleCursorPosition(hOut, pos);
cout << frame2[i] << endl;
pos.Y++;
} pos.Y -= 15;
}
void FINALBOSS::DisplayFrame3()
{
for(short i = 0; i < 15; i++)
{
SetConsoleCursorPosition(hOut, pos);
cout << frame3[i] << endl;
pos.Y++;
} pos.Y -= 15;
}
void FINALBOSS::Screenshake(short speed, short duration)
{
for(short i = 0; i < duration; i++)
{
Sleep(speed);
pos.Y = 26;
SetConsoleCursorPosition(hOut, pos);
Sleep(speed);
pos.Y = 1;
SetConsoleCursorPosition(hOut, pos);
}
}
void FINALBOSS::DrawStage()
{
for(short i = 0; i < 80; i++)
{
pos.X = i;
pos.Y = 3;
SetConsoleCursorPosition(hOut, pos);
cout << HBORD;
Sleep(5);
pos.Y = 23;
SetConsoleCursorPosition(hOut, pos);
cout << HBORD;
Sleep(5);
}
Sleep(500);
pos.Y = 2;
pos.X = 32;
SetConsoleCursorPosition(hOut, pos);
cout << "FEAR ONLY BEARS:";
pos.Y = 24;
SetConsoleCursorPosition(hOut, pos);
cout << "THE SPACE ODYSSEY";
Sleep(2000);
pos.Y = 2;
pos.X = 32;
SetConsoleCursorPosition(hOut, pos);
cout << " ";
pos.Y = 24;
pos.X++;
SetConsoleCursorPosition(hOut, pos);
cout << " ";
for(short i = 0; i < 80; i++)
{
/* top border */
pos.X = i; pos.Y = 3;
SetConsoleCursorPosition(hOut, pos);
cout << BLANK;
/* bottom border */
pos.Y = 23;
SetConsoleCursorPosition(hOut, pos);
cout << BLANK;
}
pos.X = defaultPos.X; // sfet the final boss' position
pos.Y = defaultPos.Y; // back at his idle position
}
/* movement */
void FINALBOSS::move_up()
{
if (pos.Y > 1)
pos.Y--;
}
void FINALBOSS::move_dn()
{
if (pos.Y < 10)
pos.Y++;
}
/* actions */
short FINALBOSS::Act_Random()
{
if (isActing == false)
{
dice = rand() % 3 + 1;
isActing = true;
} return dice;
}
void FINALBOSS::Act_Idle(short posX, short posY)
{
if (timer % 200 == 0)
{
if (pos.Y > posY - 7) move_up();
if (pos.Y < posY - 9) move_dn();
DisplayFrame2();
} else if (timer % 100 == 0)
{
if (pos.Y > posY - 7) move_up();
if (pos.Y < posY - 9) move_dn();
DisplayFrame3();
} timer++;
if (timer > 1000)
{
timer = 0;
isActing = false;
}
}
void FINALBOSS::Act_Headbutt()
{
if (timer > 0 && timer < 50)
{
SetConsoleTextAttribute(hOut, WHALE_GOLD);
DisplayFrame2();
SetConsoleTextAttribute(hOut, NORMAL);
DisplayFrame2();
} else if (timer > 50 && timer < 100)
{
pos.X--;
DisplayFrame1();
} else if (timer > 110 && timer < 120)
{
DisplayFrame1();
} else if (timer > 120 && timer < 170)
{
pos.X++;
DisplayFrame2();
} timer++;
if (timer > 190)
{
timer = 0;
isActing = false;
}
}
void FINALBOSS::Act_Shoot(Enemy *enemy, short iter, char mapSpace[80][25])
{
enemy->SetInSpace(true);
enemy->SetMURDERMODE(true);
if (timer > 0 && timer < 25)
{
enemy->Live(pos.X, pos.Y + 9);
SetConsoleTextAttribute(hOut, LOVE_RED);
DisplayFrame2();
SetConsoleTextAttribute(hOut, NORMAL);
DisplayFrame2();
} else if (timer > 25 && timer < 75)
{
DisplayFrame3();
enemy->move_spray(iter);
} else if (timer > 75 && timer < 100)
{
DisplayFrame2();
enemy->move_spray(iter);
} else if (timer > 100 && timer < 105)
{
enemy->Die(mapSpace);
} timer++;
if (timer > 105)
{
timer = 0;
isActing = false;
}
}
[/code][/spoiler]

[u][b]Errors[/b][/u]
[spoiler][code]1>------ Build started: Project: mfufni's The Sequel, Configuration: Debug Win32 ------
1> FINALBOSS.cpp
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(19): warning C4244: 'argument' : conversion from 'time_t' to 'unsigned int', possible loss of data
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(299): error C2039: 'Act_Shoot' : is not a member of 'FINALBOSS'
1> c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.h(10) : see declaration of 'FINALBOSS'
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(304): error C2065: 'timer' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(304): error C2065: 'timer' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(306): error C2065: 'pos' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(306): error C2228: left of '.X' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(306): error C2065: 'pos' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(306): error C2228: left of '.Y' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(307): error C2065: 'hOut' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(308): error C3861: 'DisplayFrame2': identifier not found
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(309): error C2065: 'hOut' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(310): error C3861: 'DisplayFrame2': identifier not found
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(311): error C2065: 'timer' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(311): error C2065: 'timer' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(313): error C3861: 'DisplayFrame3': identifier not found
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(315): error C2065: 'timer' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(315): error C2065: 'timer' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(317): error C3861: 'DisplayFrame2': identifier not found
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(319): error C2065: 'timer' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(319): error C2065: 'timer' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(322): error C2065: 'timer' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(324): error C2065: 'timer' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(326): error C2065: 'timer' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(327): error C2065: 'isActing' : undeclared identifier
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========[/code][/spoiler]

Also, if any of you decide to critique my code (other than for commenting because when I originally made this, I was under a strict deadline) then it'd be cool if you could tell me if there are better ways to do any of this. This is my first array-based game, made as a console application, and it's actually fairly large. I'd like to distribute it once it's finished, so sorry if I spoiled the end boss for any of you who might be curious. [img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img]

Thank you, hope I can get some answers. Edited by StoneMask

Share this post


Link to post
Share on other sites
You commented out [font=courier new,courier,monospace]Act_Shoot(Enemy *, short, char);[/font] in the header, but kept the definition in the source file. As far as the compiler is concerned, you're trying to define a member method of the class in the source file, but you don't declare it in the class (in the header), so it's complaining saying you can't do that. If it's not declared in the class (in the header), you can't add it later by defining it.

And for the record, [font=courier new,courier,monospace]Act_Shoot()[/font] should be declared as [font=courier new,courier,monospace]Act_Shoot(Enemy *, short, char*[]);[/font] or [font=courier new,courier,monospace]Act_Shoot(Enemy *, short, char**);[/font] in the header. The way it currently is, the third parameter doesn't match with the definition in the source file. Edited by Cornstalks

Share this post


Link to post
Share on other sites
Well, for example, the 'Act_Shoot' declaration in FINALBOSS.h is commented out. The compiler complains about that, and will then spew out a whole collection of errors for the body of the function because e.g. as it's not a member function, it doesn't have (unqualified) access to other members of an instance like 'timer'. More generally, a small number of errors is often unrelated, but a huge number suggests that there's a few root causes cascading, and that you're better taking the first, recompiling and repeating the process until they're hacked down to a more sensible number.

Share this post


Link to post
Share on other sites
Okay yeah, that was all stuff I did to try to change the outcome of my code. I forgot to get rid of it. Would it really mess up my timer variable, or my hOut, etc.? I'll post the fixes to the stuff like that in a little bit, but I need help on the base problem here.

Share this post


Link to post
Share on other sites
Yes, that's[quote name='StoneMask' timestamp='1343267216' post='4963136']Would it really mess up my timer variable, or my hOut, etc.? I'll post the fixes to the stuff like that in a little bit, but I need help on the base problem here.[/quote]

Yes, it would - that's why two separate people have told you so :-) You may have similar problems in other source files, but that is the cause of all the errors you've posted here. Roughly what's happening here is:

1. Compiler looks at function definition.
2. Compiler sees that it claims to be a member function, but there is no matching declaration.
3. Compiler tells you so.
4. Compiler assumes that it is [i]not [/i]a member function, and proceeds to see what sense it can make of the rest.
5. Because this assumption is wrong, Compiler thinks things which you expect to be in scope (e.g. timer) are not in scope.
6. Compiler tells you so, repeatedly.

You have to take errors after the first with a pinch of salt. With practice, you'll learn to tell when an earlier error has caused the others. Until then, as I say, a reasonable rule of thumb is that if you get [i]squillions[/i] of errors, then one of the first few is the real problem. I've had GCC spit 40 pages of errors at me, all to be fixed by changing just a couple characters in some header somewhere. Edited by TheUnbeliever

Share this post


Link to post
Share on other sites
Oh, actually, yeah, that got rid of a lot of the problems. I wonder why it didn't tell me the code was messed up when it was working fine before?

Actually, now I have one of the more frustrating problem that I probably messed up the rest of the program trying to fix.

1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(300): error C2511: 'void FINALBOSS::Act_Shoot(Enemy *,short,char [][25])' : overloaded member function not found in 'FINALBOSS'

This worked awhile back, but why is it telling me I can't have that class object as a parameter now? When I hover over it in the header file, it says "class Enemy", so it registers that it's a class object in the header, but not the .cpp? Edited by StoneMask

Share this post


Link to post
Share on other sites
At least in your initial code, Act_Shoot was declared as
[code]void Act_Shoot(Enemy *, short, char);[/code]
in the header while you appear to try calling it with a char array (possibly a C string) as a third argument. Either pass a single char there or change the signature to char* (possibly const char* since I assume you try to pass a literal) or an std::string.

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