Hi. I'm having some issues with compiling my program. I have several files: hw4-ffnn.cpp, network.{h,cpp}, neuron.{h,cpp}, and an extras.h file with a struct and some typedefs that I want common to all my files.
Here's my extras.h file:
Code:
#ifndef _extras_h_
#define _extras_h_
#include <vector>
#include <string>
struct input_node{
bool training;
vector<int> pattern, target;
};
typedef vector<input_node> input;
typedef vector< vector<int> > data;
#endif
I'm getting some inconsistent results when I use the g++ compiler with a few different options:
Code:
g++ hw4-ffnn.cpp -o hw4
works fine (actually, i get some linking errors, but I don't think that they are relevant to this issue).
However, when I do
Code:
g++ -c neuron.cpp network.cpp hw4-ffnn.cpp
I get some errors:
Code:
extras.h:10: error: ISO C++ forbids declaration of 'vector' with no type
extras.h:10: error: expected ';' before '<' token
extras.h:13: error: expected initializer before '<' token
extras.h:14: error: expected initializer before '<' token
neuron.h:16: error: ISO C++ forbids declaration of 'data' with no type
neuron.h:16: error: expected ';' before '*' token
neuron.h:27: error: 'data' has not been declared
neuron.cpp:15: error: variable or field 'set_weights' declared void
neuron.cpp:15: error: 'int Neuron::set_weights' is not a static member of 'class Neuron'
neuron.cpp:15: error: 'data' was not declared in this scope
neuron.cpp:15: error: 'w' was not declared in this scope
neuron.cpp:15: error: expected ',' or ';' before '{' token
extras.h:10: error: ISO C++ forbids declaration of 'vector' with no type
extras.h:10: error: expected ';' before '<' token
extras.h:13: error: expected initializer before '<' token
extras.h:14: error: expected initializer before '<' token
neuron.h:16: error: ISO C++ forbids declaration of 'data' with no type
neuron.h:16: error: expected ';' before '*' token
neuron.h:27: error: 'data' has not been declared
network.h:15: error: 'data' was not declared in this scope
network.h:15: error: template argument 1 is invalid
network.h:15: error: template argument 2 is invalid
network.h:22: error: 'input' does not name a type
network.h:27: error: expected `)' before '&' token
network.cpp:4: error: expected `)' before '&' token
network.cpp: In member function 'bool Network::category_exists(input_node&)':
network.cpp:32: error: 'input_layer' was not declared in this scope
network.cpp:33: error: 'struct input_node' has no member named 'target'
make: *** [compile] Error 1
Any ideas about what I'm missing?