Я пытаюсь скомпилировать эту программу, но продолжаю получать эту ошибку в журнале отчетов.
Undefined symbols for architecture x86_64:
"Net::feedForward(std::__1::vector<int, std::__1::allocator<int> > const&)", referenced from:
_main in main.o
"Net::backProp(std::__1::vector<int, std::__1::allocator<int> > const&)", referenced from:
_main in main.o
"Net::getResults(std::__1::vector<int, std::__1::allocator<int> >&) const", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Мой код прямо из учебника YouTube, которому я пытался следовать, вот main.cppкод:
#include <iostream>
#include <vector>
#include "Net.h"
int main() {
vector<int> topology;
Net myNet(topology);
//constructor needs to know # of layers it wants & # neurons per layer
vector<int> inputVals;
vector<int> targetVals;
vector<int> resultVals;
myNet.feedForward(inputVals);
//feeds inputs to begin with
myNet.backProp(targetVals);
//pass in some array with goal state
myNet.getResults(resultVals);
}
код Net.h:
#ifndef Net_hpp
#define Net_hpp
#include <stdio.h>
#include <vector>
using namespace std;
class Neuron{};
typedef vector<Neuron> Layer;
class Net{
public:
Net(const vector<int> topology);
void feedForward(const vector<int> &inputVals);
void backProp(const vector<int> &targetVals);
void getResults(vector<int> &resultVals) const;
private:
vector<Layer> m_layers; //m_layers[layerNum][neuronNum]
};
#endif /* Net_hpp */
и код Net.cpp:
#include "Net.h"
#include <vector>
Net::Net(const vector<int> topology){
int numLayers = topology.size();
for(int layerNum = 0; layerNum < numLayers; ++layerNum){
}
}
Я действительно понятия не имею, как это исправить,и другие темы с аналогичными проблемами также не помогли.Если кто-то может помочь мне, я буду очень признателен.