Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Why I can not use vectors in my c++ programs?

+1 vote
asked Mar 21, 2020 by GatCore (130 points)

Hi! I'm a new beginner-level programmer and I have a quick question.

I need to practice with vectors but when I am declaring them the compiler says this 

‘vector’ in namespace ‘std’ does not name a template type

My professor's notes say that in order to use them I need to include the Standard Template Library but in OnlineGBD it doesn't let me do it because it says that this library could not be found.

Please can you help me????

3 Answers

0 votes
answered Mar 22, 2020 by Shaik Hameed (140 points)
"using namespace std;

vector<int> v;"

The above code should work in online gdb environment.
0 votes
answered Mar 25, 2020 by hardikhere (140 points)
u must include

#include<vector>

or #include<bits/stdc++.h>

using namespace std;

it would work for sure in onlinegb too
0 votes
answered Mar 25, 2020 by Adithya S (170 points)
vectors are part of the header file
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...