I'm currently on Tutorial 12 of the beginner C++ series, I'm now using the game constructor initialiser list to set the poo position with the random number generator.
it throws an error which is directly related to the poo constructor, although i cant figure out what is wrong. everything looks right, and I've even double checked the video. I've included the error code, and code from my project.
Error LNK2019 unresolved external symbol "public: __thiscall Poo::Poo(int,int,int,int)" (??0Poo@@QAE@HHHH@Z) referenced in function "public: __thiscall Game::Game(class MainWindow &)" (??0Game@@QAE@AAVMainWindow@@@Z) Engine C:\Users\Ross\Desktop\Chili Framework 2016-7-10\Engine\Game.obj 1
Code: Select all
Game::Game( MainWindow& wnd )
:
wnd( wnd ),
gfx( wnd ),
rng(rd()),
xDist(0,770),
yDist(0,570),
Poo0(xDist(rng), yDist(rng), 1, 1 ),
Poo1(xDist(rng), yDist(rng), -1, 1),
Poo2(xDist(rng), yDist(rng), 1, -1)
{
}
Code: Select all
class Poo
{
public:
Poo(int in_x, int in_y, int in_vx, int in_vy);
void Update();
void OverlapTest(int dudex, int dudey, int width, int height);
void Draw( Graphics& gfx) const;
bool IsEaten() const;
private:
int x;
int y;
int vx;
int vy;
static constexpr int width = 24;
static constexpr int height = 24;
bool Eaten = false;
};
Code: Select all
class Game
{
public:
Game( class MainWindow& wnd );
Game( const Game& ) = delete;
Game& operator=( const Game& ) = delete;
void Go();
private:
void ComposeFrame();
void UpdateModel();
/********************************/
/* User Functions */
void DrawEndGame(int x, int y);
void DrawTitlePage(int x, int y);
/********************************/
private:
MainWindow& wnd;
Graphics gfx;
/********************************/
/* User Variables */
std::random_device rd;
std::mt19937 rng;
std::uniform_int_distribution<int> xDist;
std::uniform_int_distribution<int> yDist;
dude dude0;
Poo Poo0;
Poo Poo1;
Poo Poo2;
bool IsStarted = false;
bool EndGame = false;[/quote]