The following simple volcalc.cpp code compiles with no errors (and works) in Windows Visual C++.
It simply sizes the "alldata" array later in the code.
With g++ v.4.3.2 for Linux instead I get the error reported hereby.
I would thankfully appreciate any help (including tough critics to the code).
volcalc.cpp:26: error: template argument for ‘template<class _Alloc> class std::allocator’ uses local type ‘main(int, char**)::series’
volcalc.cpp:26: error: trying to instantiate ‘template<class _Alloc> class std::allocator’
volcalc.cpp:26: error: template argument 2 is invalid
volcalc.cpp:66: error: request for member ‘resize’ in ‘alldata’, which is of non-class type ‘int’
1 2 3 4 5 6 7 8 9 10 11 12 13
int main(int argc, char *argv[])
{
struct series {
....
};
int nr;
....
vector<series> alldata; // line 26
.... // calculate nr as int.
alldata.resize(nr); // line 66
}
I just compiled your code on linux. I this for some reason it does not like the fact that struct is declared local. If you declare struct as global it will be working.