How to connect header with no error?

There are 4 file
layer.hpp
#pragma once

class Neuron;

class Layer
{
private:
 Neuron *neurons;
 int size;
public:
Layer();
~Layer();
};
neuron.hpp
#pragma once

class Layer;

class Neuron
{
private:
 float *weight;
public:
Neuron();
~Neuron();
 float execute(const Layer &layer);
};

layer.cpp
#include "layer.hpp"

Layer::Layer(){}
Layer::~Layer(){}

neuron.cpp
#include "neuron.hpp"

Neuron::Neuron() {}
Neuron::~Neuron(){}
float Neuron::execute(const Layer &layer)
{
 return 0.0;
}



and main.cpp
#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?
June 3rd 19 at 19:03
1 answer
June 3rd 19 at 19:05
Solution
Why the g++ compiler says that you have not defined the constructors and destructors method?

g++ main.cpp neuron.cpp layer.cpp -o test
The way it works.
How to do that I would not have had to register all the files? - Sterling_Farre commented on June 3rd 19 at 19:08
does. Or as above to compile everything separately and then list all the source files in the compiler command line (or use *.cpp) or connect an implement in a single compiled file, and then list them in this file. - demetrius.Bedn commented on June 3rd 19 at 19:11
What's the point of header ' s, if you need cpp to connect? - Sterling_Farre commented on June 3rd 19 at 19:14
What's the meaning of the header ' s

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

Find more questions by tags C++