So I made this practice file for my project to try and read a file containing integer numbers, and store them in an int vector. My problem is whenever I run the program, it will give me "Segmentation fault (core dumped)" during the call to the readFile() function. 
Do not mind the extra imports, I just copy and paste the same imports to all my practice files. Also the cout << "hi" << endl; is just to see when the program has the error.
#include <string>
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <cassert>
#include <vector>
using namespace std;
vector<int> readFile(string fileName);
int main()
{
    vector <int> intvec = readFile("ints.txt");
    cout << "hi" << endl;
    for (int i = 0; i < intvec.size(); i++)
    {
        cout << intvec[i] << endl;
    }
    return 0;
}
vector<int> readFile(string fileName)
{
    ifstream inFile(fileName);
    vector<int> inputVec;
    int i = 0;
    while (!inFile.eof())
    {
        inFile >> inputVec[i];
        i++;
    }
    inFile.close();
    return inputVec;
}
 
     
     
     
    