0

I can't understand why I get the following errors, since I have included all the libraries and everything is more public than it should have been!! Probably it's something I haven't grasped or a stupid mistake.. Could you please help!!

Errors: "undefined reference to cell::cell(float)" "undefined reference to exploration::exploration(bool,float,int)"

Disregard the non existent encapsulation.

#include <iostream>
#include "vehicle.h"
#include "tool.h"
#include <vector>
#include <stdlib.h>
#include <time.h>
#include "exploration.h"
#include "analyze.h"
#include "repair.h"
#include "cell.h"

int main()
{
int k=0;
std::vector <cell> cells;
std::vector <Exploration> vexp;
std::vector <analyze> anal;
std::vector <Repair> reps;
srand (time(NULL));

std::cout << "Enter number of cells\n";
std::cin.clear();
std::cin >> k;
r = rand() % 100+1;
for(int i=0; i<k; i++)
{
    cell tempcell (0.1);
    cells.push_back(tempcell);
}
for(int i=1; i<9; i++)
{
    Exploration temp (0,3,3);
    vexp.push_back(temp);
}
}

cell.h:

#ifndef CELL_H
#define CELL_H
#include<vector>

class cell
{
public:
cell (float);
int Pd;
int Ir;
int Pt;
float Danger;
bool Flag;
bool Occupied;

int RandGround();
void ChangeFlag();
void ChangeGround();
};

#endif // CELL_H

cell.cpp:

#include "cell.h"
#include <time.h>
#include <stdlib.h>

cell :: cell (float Dang)
{
Pd = RandGround();
Ir = RandGround();
Pt = RandGround();
Danger = Dang;
Flag = 0;
Occupied = 0;
}


int cell::RandGround()
{
int r;
srand(time(NULL));
return r;
}
John Zwinck
  • 239,568
  • 38
  • 324
  • 436
alex777
  • 167
  • 5
  • 14

0 Answers0