#pragma once
class Neuron;
class Layer
{
private:
Neuron *neurons;
int size;
public:
Layer();
~Layer();
};
#pragma once
class Layer;
class Neuron
{
private:
float *weight;
public:
Neuron();
~Neuron();
float execute(const Layer &layer);
};
#include "layer.hpp"
Layer::Layer(){}
Layer::~Layer(){}
#include "neuron.hpp"
Neuron::Neuron() {}
Neuron::~Neuron(){}
float Neuron::execute(const Layer &layer)
{
return 0.0;
}
#include "neuron.hpp"
#include "layer.hpp"
int main(int argc, char const *argv[])
{
Neuron n;
Layer l;
return 0;
}
Why the g++ compiler says that you have not defined the constructors and destructors method?
g++ main.cpp neuron.cpp layer.cpp -o test
Find more questions by tags C++
How to do that I would not have had to register all the files? - Sterling_Farre commented on June 3rd 19 at 19:08
That the headers describe the interface and provides the implementation of the cpp. If the implementation changes, you need to recompile a single file. In the project consisting of 3 files -- are out of date, but the project of 1000 files, you can notice the difference. Read something about modularity, for example. - demetrius.Bedn commented on June 3rd 19 at 19:17