This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: question about compiling with g++ 3.1 version


> Dear gcc users,
> 
> I tried to compile one program that is compilable with g++ 2.95.3
> version..
> 
> The is problem with these lines:
> 
> class VectorMultiset {
>   typedef vector< multiset<unsigned long>* >::iterator VSI;
>   typedef vector< multiset<unsigned long>* >::const_iterator CVSI;
>  ....
> 
> I got error message:
> 
> In file included from vertices.h:6,
>                  from coalescent.h:13,
>                  from Coalescent7.cc:5:
> vectormultiset.h:13: ISO C++ forbids declaration of `vector' with no type
> vectormultiset.h:13: template-id `vector<std::multiset<long unsigned int,
>    std::less<long unsigned int>, std::allocator<long unsigned int> >*>'
> used as
>    a declarator
> vectormultiset.h:13: parse error before `::' token
> vectormultiset.h:14: non-template type `vector' used as a template
> vectormultiset.h:14: ISO C++ forbids declaration of `const_iterator' with
> no
>    type
> vectormultiset.h:14: confused by earlier errors, bailing out
> Exit 1
> 
> How I can do vector< multiset<unsigned long>* > in g++ 3.1 version?
> 
> Janos

Hi,

the problem just is that you have to use "std::vector" instead of "vector"
(or use a using declaration "using std::vector;").

The standard library lives in namespace "std" (but g++ 2.95.3 wasn't aware of that).

Oliver


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]