
Originally Posted by
bar_ba_dos
Suppose I have the following sample header file test.h
You have so many things wrong.
Code:
#include "myCommon.h"
class Test
{
public:
Test();
vector<vector<vector<double>>> vI3(dim1, vector<vector<double>> (dim2, vector<double> (dim2, 0.0f)));
private:
fillVector();
}
So how is the compiler supposed to know what "vector" is? You never state #include <vector> anywhere.
Second, this is not a declaration:
Code:
vector<vector<vector<double>>> vI3(dim1, vector<vector<double>> (dim2, vector<double> (dim2, 0.0f)));
What is that code supposed to do when you place it in the class declaration? That line of code belongs in a function.
The bottom line is this:
When you create a header file, you're supposed to #include anything it needs to compile successfully without any "help" from outside. For example, this one line CPP file must compile without error:
Try to compile that one line of code. If it doesn't compile, you go into test.h and fix the errors.
Regards,
Paul McKenzie