Why can't I call a class's non-default constructor in another file?
<p>I am fairly new to C++. I have started writing a class called Row, and I am trying to call a non-default constructor to create a row object in a separate main.cpp file, but I keep getting an error that I do not understand. Can anyone explain to me what I've done wrong?</p>

<p>Here are my three files:</p>

<p>Row.h</p>

<pre><code>#ifndef ROW_H
#define ROW_H
#include&lt;vector&gt;
#include&lt;iostream&gt;

class Row {
    std::vector&lt;int&gt; row;
public:
    // constructor
    Row(std::vector&lt;int&gt; row);
};

#endif
</code></pre>

<p>Row.cpp</p>

<pre><code>#include&lt;vector&gt;
#include&lt;iostream&gt;
#include "Row.h"

// constructor
Row::Row(std::vector&lt;int&gt; row_arg) {
    row = row_arg;
}
</code></pre>

<p>main.cpp</p>

<pre><code>#include&lt;vector&gt;
#include&lt;iostream&gt;
#include "Row.h"
using namespace std;

int main() {
    vector&lt;int&gt; v = {1, 2, 3, 4};
    Row row(v);
    return 0;
}
</code></pre>

<p>The error I receive upon trying to compile main.cpp is this:</p>

<pre><code>/tmp/ccJvGzEW.o:pascal_classes.cpp:(.text+0x71): undefined reference to `Row::Row(std::vector&lt;int, std::allocator&lt;int&gt; &gt;)'
/tmp/ccJvGzEW.o:pascal_classes.cpp:(.text+0x71): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `Row::Row(std::vector&lt;int, std::allocator&lt;int&gt; &gt;)'
collect2: error: ld returned 1 exit status
</code></pre>