I know there are similar questions but none of these work in my case. Hi I cannot find why I have this issue. Here is my individual.h file:
#ifndef INDIVIDUAL_H
#define INDIVIDUAL_H
#include <vector>
#include <stdlib.h>
#include <time.h>
#include <iostream>
using namespace std;
class Individual{
private:
vector<unsigned int> chromosome;
unsigned int n_genes;
unsigned int N_colours_used = 0;
unsigned int fitness = 0;
public:
Individual(unsigned int ngenes){};
};
#endif
And this is my individual.cpp file:
#include "individual.h"
Individual :: Individual(unsigned int ngenes){
cout << "something" << endl;
}
The error looks like this
src/individual.cpp:4:1: error: redefinition of ‘Individual::Individual(unsigned int)’
Individual :: Individual(unsigned int ngenes){
^
In file included from src/individual.cpp:1:0:
include/individual.h:24:13: note: ‘Individual::Individual(unsigned int)’ previously defined here
Individual(unsigned int ngenes){};
I tried everything thats in stackoverflow but I still don't know how to solve this problem. Also
"#pragma once" does not work.