help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

vector<> error


From: mamboknave
Subject: vector<> error
Date: Sun, 19 Apr 2009 13:41:24 -0700 (PDT)
User-agent: G2/1.0

The following simple volcalc.cpp code compiles with no errors (and
works) in Windows Visual C++.
With g++ v.4.3.2 instead I get the reported error.

I would thankfully appreciate any help.

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’

int main(int argc, char *argv[])
{
        struct series {
                ....
        };
        int nr;
....
        vector<series> alldata;   // line 26

....    // calculate nr;

        alldata.resize(nr);  // line 66



reply via email to

[Prev in Thread] Current Thread [Next in Thread]