help-gplusplus
[Top][All Lists]
Advanced

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

Re: vector not linked?


From: Samik Raychaudhuri
Subject: Re: vector not linked?
Date: Mon, 14 Jun 2004 14:36:49 -0400
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040514

Well .. I had to specify the type as vector<int> v. My assumption that default type was int was not correct.
-Samik

On 6/14/2004 1:43 PM, Samik Raychaudhuri wrote:

Hello,
I am using cygwin version of gcc/g++ 3.3.1 [current build] and trying to compile the following simple program:

-------------------------------
#include <iostream>
#include <vector>
using namespace std;

int main()
{       vector v;
      v.push_back(12);
      v.push_back(20);
      for(int i=0;i<v.size();i++)
      {       cout<<v[i]<<endl;       }
}
------------------------------------------

This is the error msg I am getting:
v.cpp: In function `int main()':
v.cpp:6: error: `vector' undeclared (first use this function)
v.cpp:6: error: (Each undeclared identifier is reported only once for each
 function it appears in.)
v.cpp:6: error: syntax error before `;' token
v.cpp:7: error: `v' undeclared (first use this function)

Am I missing something or is g++ broken?
Thanks for any pointers.
Regards.
-Samik
----------------
Change 'K' to 'e' to mail me directly.


reply via email to

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