I am making a program with a list of baby names but I've decided to make a seperate function to open the file, this is what I have got so far.
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
void open_file(ifstream& in, char fileName[]);
void find_name(ifstream& in, string name, int numNames);
int main() {
    const int NUMNAMES = 1000;
    ifstream inStream;
    char fileName[30];
    string name;
    cout << "Enter the name of the file that contains the names: " << endl;
    open_file(inStream, fileName);
    cout << "Enter the name to search for (capitalize first letter): " << endl;
    cin >> name;
    find_name(inStream, name, NUMNAMES);
    inStream.close();
}
void open_file(ifstream& ) {
    string line;
    ifstream myfile ("babyNames.txt");
    if (myfile.is_open())
    {
        while ( getline (myfile,line) )
        {
            cout << line << '\n';
        }
        myfile.close();
    }
    else cout << "I/O failure opening file babyNames";
}
Does anyone know why I am getting so many error messages:
Undefined symbols for architecture x86_64:
  "find_name(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int)", referenced from:
      _main in Untitled-1b6d2e.o
  "open_file(std::__1::basic_ifstream<char, std::__1::char_traits<char> >&, char*)", referenced from:
      _main in Untitled-1b6d2e.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Does anyone know what I am doing wrong, I feel like it is relatively close I'm just fairly new to streams in c++.
 
    