STL

Post here if you don't find any other place for your post. But please, stay on-topic: algorithms, programming or something related to this web site and its services.

Moderator: Board moderators

Post Reply
katundu
New poster
Posts: 3
Joined: Thu Aug 21, 2003 10:21 am

STL

Post by katundu »

I am having a hard time finding a compiler where STL works. It seems that it is not as standard as it should be. My gcc compiler (ver 3.x.x) does not accept this code, it complains about the vector declaration in the main program and not the library declaration.

#include<iostream>
#include<vector>

main(){
vector<int> vect;
}

Any thoughts concerning this situation would be appreciated.
Per
A great helper
Posts: 429
Joined: Fri Nov 29, 2002 11:27 pm
Location: Sweden

Post by Per »

The vector class is declared in another namespace (namely the std namespace), so you must either write "using namespace std;" somewhere, or use the form "std::vector<int>".

(Hint: there is a C++ forum, where topics like this are not off-topic)
Krzysztof Duleba
Guru
Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland
Contact:

Post by Krzysztof Duleba »

It's enough to write
[cpp]using namespace vector;[/cpp]
In some (rare) cases using namespace std can couse some troubles.
Post Reply

Return to “Other words”