[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with standard template library
From: |
Guy Harrison |
Subject: |
Re: Problem with standard template library |
Date: |
Thu, 30 Sep 2004 16:59:10 GMT |
User-agent: |
KNode/0.7.7 |
Carl Flarity wrote:
> I'm new at using gcc and new at using templates.
Lurk on comp.lang.c++ and especially alt.comp.lang.learn.c-c++ as it
specialises in explaining (standard) language issues. Gcc specific stuff
comes here of course.
> Please help me figure out what I'm doing wrong in the
> following program. Is there something additional I
> need to do to let the compiler know that vector is a
> template?
Nope. All you have is an omission as explained by Paul.
> Thanks,
> Carl Flarity
>
> //////////////////////////////////////////////////
> #include <vector>
>
> int main(void){
>
> vector<int> v;
>
> }
>
> /*
> Gives following output when I compile with gcc
> version 3.3.3 (SuSE Linux) ...
>
> gcc VectorTemplate.cpp -o VectorTemplate
^^^
Use gcc for C and g++ for C++. This also applies when linking.
> VectorTemplate.cpp: In function `int main()':
> VectorTemplate.cpp:5: error: `vector' undeclared
> (first use this function)
> VectorTemplate.cpp:5: error: (Each undeclared
> identifier is reported only once
> for each function it appears in.)
> VectorTemplate.cpp:5: error: syntax error before `>'
> token
> make: *** [VectorTemplate] Error 1