.txt function not linking to main function : <p>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.</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;

using namespace std;


void open_file(ifstream&amp; in, char fileName[]);
void find_name(ifstream&amp; in, string name, int numNames);



int main() {

    const int NUMNAMES = 1000;
    ifstream inStream;
    char fileName[30];
    string name;
    cout &lt;&lt; "Enter the name of the file that contains the names: " &lt;&lt; endl;
    open_file(inStream, fileName);
    cout &lt;&lt; "Enter the name to search for (capitalize first letter): " &lt;&lt; endl;
    cin &gt;&gt; name;
    find_name(inStream, name, NUMNAMES);
    inStream.close();

}


void open_file(ifstream&amp; ) {

    string line;
    ifstream myfile ("babyNames.txt");
    if (myfile.is_open())
    {
        while ( getline (myfile,line) )
        {
            cout &lt;&lt; line &lt;&lt; '\n';
        }
        myfile.close();
    }

    else cout &lt;&lt; "I/O failure opening file babyNames";


}
</code></pre>

<p>Does anyone know why I am getting so many error messages:</p>

<pre><code>Undefined symbols for architecture x86_64:
  "find_name(std::__1::basic_ifstream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;, std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;, int)", referenced from:
      _main in Untitled-1b6d2e.o
  "open_file(std::__1::basic_ifstream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;, 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)
</code></pre>

<p>Does anyone know what I am doing wrong, I feel like it is relatively close I'm just fairly new to streams in c++.</p>
