Symbol(s) not found for architecture x86_64 - Cmake - Mac sierra
<p>Recently I have started a new project in C++. The problem is, when I try to compile it I get a linking error. I spent the whole day today trying to debug it, but I did not really find a good solution anywhere. If someone could help with it it would be amazing. I am using a Mac Sierra.</p>

<p><strong><code>parsing/methylation.h</code></strong></p>

<pre><code>#ifndef EPIRL_METHYLATION_H
#define EPIRL_METHYLATION_H

#include &lt;stdio.h&gt;
#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;vector&gt;
#include &lt;sstream&gt;

using namespace std;

namespace methylation {
    struct MethLine {
        string chr;
        int coord;
        char strand;
        int methylated;
        int un_methylated;
        string context;
        string tag;
    };

    string calculateMethylationByContext(
            MethLine m_input[], int length,
            int window_start, int window_end, int threshold);

    void calculateMethylation(
        const istream &amp;methylation_stream,
        const istream &amp;coordinate_stream,
        const ostream &amp;output_stream
    );
}

#endif //EPIRL_METHYLATION_H
</code></pre>

<p><strong><code>parsing/methylation.cpp</code></strong></p>

<pre><code>#include "methylation.h"

namespace methylation {
    string calculateMethylationByContext(
            MethLine m_input[], int length,
            int window_start, int window_end, int threshold) {
// rest of the code ...
    }
}
</code></pre>

<p><strong><code>main.cpp</code></strong></p>

<pre><code>#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include "parsing/methylation.h"

using namespace std;

int main(int argc, char **argv) {
    if (argc != 4) {
        cout &lt;&lt; "Invalid number of arguments..." &lt;&lt; endl;
        return 1;
    }

    char *methylation_file = argv[1];
    char *coordinate_file = argv[2];
    char *output_file = argv[3];

    ifstream methylation_file_stream(methylation_file, ios::binary);
    ifstream coordinate_file_stream(coordinate_file, ios::binary);
    ofstream output_file_stream(output_file, ios::binary);

    methylation::calculateMethylation(methylation_file_stream,
                         coordinate_file_stream, output_file_stream);
    methylation_file_stream.close();
    coordinate_file_stream.close();
    output_file_stream.close();

    return 0;
}
</code></pre>

<p>I use CLion for my coding. When I try to build it, my cmake command works fine, but when I then click 'make' I get the following error: </p>

<pre><code>Undefined symbols for architecture x86_64:
  "methylation::calculateMethylation(std::__1::basic_istream&lt;char, std::__1::char_traits&lt;char&gt; &gt; const&amp;, std::__1::basic_istream&lt;char, std::__1::char_traits&lt;char&gt; &gt; const&amp;, std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt; const&amp;)", referenced from:
      _main in main.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [src] Error 1
make[2]: *** [CMakeFiles/src.dir/all] Error 2
make[1]: *** [CMakeFiles/src.dir/rule] Error 2
make: *** [src] Error 2
</code></pre>

<p>my <strong>CMakeLists.txt</strong> file looks like the following:</p>

<pre><code>cmake_minimum_required(VERSION 3.6)
project(src)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

set(SOURCE_FILES
    parsing/methylation.cpp
    parsing/methylation.h
    main.cpp)

add_executable(src ${SOURCE_FILES})
</code></pre>

<p>When I run the cmake command, my output is this: </p>

<pre><code>-- The C compiler identification is AppleClang 8.0.0.8000042
-- The CXX compiler identification is AppleClang 8.0.0.8000042
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/sztankatt/Documents/University/PartIII/Project/epiRL/src
</code></pre>