Question: I keep getting this error from my code and have no clue why: Error: Undefined symbols for architecture x86_64: board::board(), referenced from: _main in main.o

I keep getting this error from my code and have no clue why:

Error:

Undefined symbols for architecture x86_64:

"board::board()", referenced from:

_main in main.o

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

code:

#include

#include

#include

#include

#include

using namespace std;

class board;

class creature;

class ant;

class doodlebug;

class invisible;

//Indicates the integer that represents each creature

const int antInd= 1;

const int doodlebugInd = 2;

const int invisibleInd = 3;

class board {

friend class creature;

friend class ant;

friend class doodlebug;

friend class invisible;

public:

board();

// int** creaturePtr;

int** grid;

int** createGrid();

void initialize();

void simTurn();

void printGrid();

};

class creature {

friend class board;

public:

creature(int number, int x, int y);

void move();

void breed();

void starve();

int getType();

creature getCreature();

creature setCreature();

};

class ant {

friend class board;

private:

ant(int number, int x, int y);

int getType() {

return 1;

}

void move();

void breed();

};

class doodlebug {

friend class board;

private:

doodlebug(int number, int x, int y);

int getType() {

return 2;

}

void move();

void breed();

void starve();

void eat();

};

class invisible {

friend class board;

private:

invisible(int number, int x, int y);

int getType() {

return 3;

}

};

void board::initialize() {

int ants = 0;

int doodlebugs = 0;

int empty=0;

while(doodlebugs

int x = rand()%20;

int y= rand()%20;

grid[x][y] = 2;

doodlebugs++;

}

while(ants

int x = rand()%20;

int y= rand()%20;

grid[x][y] = 1;

ants++;

}

while(empty

int x = rand()%20;

int y= rand()%20;

grid[x][y] = 3;

empty++;

}

}

void board::printGrid() {

for(int i=0;i

for(int j=0;j

if(grid[i][j] == 1) {

cout

}

else if(grid[i][j] == 2) {

cout

}

else {

cout

}

}

}

}

int main() {

srand(time(NULL));

board Board;

Board.initialize();

Board.printGrid();

}

The question is below. I am not looking for the answer and understand that my code is highly incomplete as its just an early version to get the initial board to print, I just why

my current code isn't working. Thank you

I keep getting this error from my code and have no clue

this is a simple predator-prey simulation game implemented in C++ in this game, the prey are ants and the predators are doodlebugs. they live in 20x20 grid of cells where only one critter may occupy a cell at a time and a critter is not allowed to move off the edges of the world. time is simulated in time steps and each critter performs action each time step. ants' actions at each time step is described as follows: 1. move - at each time step, a random move is generated to: up, down, right or left. if the neighboring cell in the selected direction is occupied or it would move off the grid, the any stays in the current cell. 2. breed if an ant survives three time steps, then after it moves, the ant breeds. this is simulated by creating a new ant in an adjacent cell (up, down, right or left) that is empty. if there is no empty cell available, then the ant breeds when an empty cell becomes available at a subsequent time step doodlebugs' action at each time step is described as follows: 1. move - at each time step, if there is an adjacent (up, down, right or left) ant, then a doodlebug randomly chooses which ant to eat by moving to the cell containing that ant. if there is no ant available to eat in an adjacent cell, then the doodlebug moves in the same manner as an ant 2. breed if a doodlebug survives for eight time steps, then after it moves, it breeds in the same manner as an ant 3. starve if a doodlebug has not eaten an ant within last three time steps, then at the end of the time step (after it moved and bred) it starves and dies. this is simulated by the doodlebug being removed from the grid of cells at each time step, doodlebugs move first and then ants move. doodlebugs and ants breed at the same time. and at the end of each time step, some doodlebugs may starve. priority of each action is given to earlier cell in the grid; if a cell in a grid can be represented as grid[row] [col], then a cell c1 (grid [row1][col]) is earlier than a cell c2 (grid [row2][col2]) if row!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!