Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot include <vector> [closed]

Tags:

c++

gcc

vector

I am using gcc under OS X and I get an error

fatal error: 'vector' file not found

when trying to include the vector implementation. Other includes like

#include <stdio.h>
#include <stdlib.h>

are working. Where is the vector file located?

like image 667
Alex Avatar asked Mar 01 '26 23:03

Alex


2 Answers

vector is not part of C. You must use C++.

Try compiling with g++ rather than gcc

like image 148
Rishit Sanmukhani Avatar answered Mar 03 '26 12:03

Rishit Sanmukhani


The vector C++ header enables the use of vector template class.

Include :

#include<vector>

and compile the program using g++.

like image 31
sjsam Avatar answered Mar 03 '26 11:03

sjsam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!