Witam, przerabiam podstawowy kurs budowania sieci neuronowych, ale mam pwien probem związany z kompilacją programu. Nie rozumiem co to za błęðy i czemu one wystepują.
Mój kod:
#include <vector>
#include <iostream>
using namespace std;
class Neuron{
public:
private:
}
typedef vector<Neuron> Layer;
class Net{
public:
Net(const vector<unsigned> &topology);
void feedForward(const vector<double> &inputVals);
void backProp(const vector<double> &targetVals);
void getResults(vector<double> &resultVals) const;
private:
vector<Layer> m_layers;
};
Net::Net(const vector<unsigned> &topology){
unsigned numLayers = topology.size();
for(unsigned layerNum = 0; layerNum < numLayers; ++layerNum){
m_layers.push_back(Layer());
//We have made a new layer. Now fill it with neurons, and
//add a bias neuron to the layer
for(unsigned neuronNum = 0; neuronNum <= topology[layerNum]; ++neuronNum){
m_layers.back().push_back(Neuron());
}
}
}
int main(){
//e.g. {3, 2, 1}
//3 layers
//first layer have 3 inputs
//seckond have 2 hidden neuron
//third have one output
vector<unsigned> topology;
Net myNet(topology);
vector<double> inputVals;
myNet.feedForward(inputVals);
vector<double> targetVals;
myNet.backProp(targetVals);
vector<double>resultValu;
myNet.getResults(resultValu);
return 0;
}
Błędy:
main.cpp:13:24: error: invalid declarator before ‘Layer’
typedef vector<Neuron> Layer;
^
main.cpp:22:9: error: ‘Layer’ was not declared in this scope
vector<Layer> m_layers;
^
main.cpp:22:14: error: template argument 1 is invalid
vector<Layer> m_layers;
^
main.cpp:22:14: error: template argument 2 is invalid
main.cpp: In constructor ‘Net::Net(const std::vector<unsigned int>&)’:
main.cpp:28:12: error: request for member ‘push_back’ in ‘((Net*)this)->Net::m_layers’, which is of non-class type ‘int’
m_layers.push_back(Layer());
^
main.cpp:28:28: error: ‘Layer’ was not declared in this scope
m_layers.push_back(Layer());
^
main.cpp:33:13: error: request for member ‘back’ in ‘((Net*)this)->Net::m_layers’, which is of non-class type ‘int’
m_layers.back().push_back(Neuron());
Z góry dziękuje za pomoc :D