<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Undefinied Reference to...]]></title><description><![CDATA[<p>Ich bekomme jedes mal beim compilieren diese Fehler</p>
<blockquote>
<p>C:\Users\White\AppData\Local\Temp/ccWz4PlV.o:notice.c:(.text+0x12f): undefined reference to `Notice:<br />
:Notice()'<br />
collect2: ld returned 1 exit status</p>
</blockquote>
<p>Ich bin noch relativer Anfänger und hab nun Stunden damit verbracht, rauszufinden was der Fehler heißt bzw. bedeuten mag und wie ich dagegen vorgehen kann, hab nun aber keine Lust mehr bzw. bin am verzweifeln und das hier ist mein letzter Anlauf diese Frage vllt erklärt zu bekommen.</p>
<p>Der Code ist folgender:</p>
<p>notice.c:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &quot;Notice.class.h&quot;

using namespace std;

int main() {
    Notice n;

    /*string command;
    getline(cin, command);

    if (command.substr(0, 3) == &quot;add&quot;) {
        command = command.replace(0, 3, &quot;&quot;);

        n-&gt;addNotice(command);
    } else if (command.substr(0, 4) == &quot;done&quot;) {
        command = command.replace(0, 4, &quot;&quot;);

        n-&gt;remove_notice(command);
    }

    cout &lt;&lt; n-&gt;count_view() &lt;&lt; &quot; Notizen liegen noch vor&quot; &lt;&lt; endl;*/

    //delete n;
}
</code></pre>
<p>Notice.class.h</p>
<pre><code class="language-cpp">#pragma once

#include &lt;time.h&gt;
#include &lt;string.h&gt;
#include &lt;vector&gt;
#include &lt;stdio.h&gt;

using std::string;
using std::vector;

class Notice {
    public:
        Notice();
        bool addNotice(string notice);
        string getNotice(string match, int time_stamp = 0);
        vector&lt;string&gt; getNotice(int time_stamp = 0);
        bool remove_notice(string match, int time_stamp = 0);
        int count_view();
    private:
        bool _exist_notice(string match, int time_stamp = 0);
        bool _exist_file(string file);
        void _clear();
        void _create_date(char* &amp;refer, int timestamp = 0);
        void _write_into(vector&lt;string&gt; output, int time_stamp = 0);

        char* _current_file;
        vector&lt;string&gt; _files;
};
</code></pre>
<p>Notice.class.c</p>
<pre><code class="language-cpp">#include &quot;Notice.class.h&quot;

Notice::Notice() {
    this-&gt;_create_date(this-&gt;_current_file);

    if (!this-&gt;_exist_file(this-&gt;_current_file)) {
        FILE* f = fopen(this-&gt;_current_file, &quot;w+&quot;);
        fclose(f);
    }

    this-&gt;_clear();
}

void Notice::_create_date(char* &amp;refer, int timestamp) {
    time_t cur_time = time(0);
    tm*    timer    = localtime(&amp;cur_time);

    sprintf(
        refer,
        &quot;%d-%d-%d.txt&quot;,
        timer-&gt;tm_mday,
        (timer-&gt;tm_mon + 1),
        (timer-&gt;tm_year + 1900)
    );
}

int Notice::count_view() {
    vector&lt;string&gt;::iterator it;
    int count = 0;

    while (it != this-&gt;_files.end()) {
        count++;

        it++;
    }

    return count;
}

bool Notice::addNotice(string notice) {
    if (!this-&gt;_exist_notice(notice)) {
        FILE* f = fopen(this-&gt;_current_file, &quot;a&quot;);
        fputs(notice.c_str(), f);
        fclose(f);

        return true;
    }

    return false;
}

string getNotice(string match, int time_stamp) {
    int offset = 200;
    char* search;

    this-&gt;_create_date(search, time_stamp);
    if (time_stamp &gt; 0 &amp;&amp; !binary_search(this-&gt;_files.begin(), this-&gt;_files.end(), search)) {
        return null;
    }

    if (time_stamp &lt;= 0) {
        search = this-&gt;_current_file;
    }

    if (!this-&gt;_file_exists(search)) {
        return null;
    }

    FILE* f = fopen(search, &quot;r&quot;);

    char line[offset];
    while (!feof(f)) {
        fgets(line.c_str(), offset, f);

        if (strstr(match.c_str(), line)) {
            return line;
        }
    }

    fclose(f);

    return null;
}

vector&lt;string&gt; Notice::getNotice(int time_stamp) {
    int offset = 200;
    char* search;

    vector&lt;string&gt; output;

    output.reserve(20);
    output.resize(10);

    this-&gt;_create_date(search, time_stamp);
    if (time_stamp &gt; 0 &amp;&amp; !binary_search(this-&gt;_files.begin(), this-&gt;_files.end(), search)) {
        return null;
    }

    if (time_stamp &lt;= 0) {
        search = this-&gt;_current_file;
    }

    if (!this-&gt;_file_exists(search)) {
        return null;
    }

    FILE* f = fopen(search, &quot;r&quot;);

    char line[offset];
    int counter = 0;
    while (!feof(f)) {
        counter++;

        if (counter &gt;= output.size()) {
            output.resize(output.size() + 10);
        }

        fgets(line.c_str(), offset, f);

        if (strlen(line)) {
            output.push_back(line);
        }
    }

    fclose(f);

    return output;
}

bool Notice::_exist_notice(string match, int time_stamp = 0) {
    string search = this-&gt;getNotice(match, time_stamp);

    return search == null ? false : true;
}

bool Notice::remove_notice(string match, int time_stamp) {
    vector&lt;string&gt; output = this-&gt;getNotice(time_stamp);
    vector&lt;string&gt;::iterator it;

    while (it != output.end()) {
        if (output[it].find(match)) {
            it = output.erase(it);

            this-&gt;_write_into(output, time_stamp);

            return true;
        }

        it++;
    }

    return false;
}

void Notice::_write_into(vector&lt;string&gt; output, int time_stamp) {
    char* search;

    if (time_stamp &gt; 0) {
        this-&gt;_create_date(search, time_stamp);
    } else {
        search = this-&gt;_current_file;
    }

    if (!this-&gt;_file_exists(search)) {
        return null;
    }

    FILE* f = fopen(search, &quot;w+&quot;);

    vector&lt;string&gt;::iterator it;
    while (it != output.end()) {
        fputs(output[it], f);

        it++;
    }

    fclose(f);
}

void Notice::_clear() {
    string sub = this-&gt;_current_file.substr(0, this-&gt;_current_file.find(&quot;.&quot;, 0));
    int last_day = timer-&gt;tm_mday;

    this-&gt;_files.resize(5);
    for (int i = 5; i &gt; 0; i++) {
        last_day -= 1;

        string name = this-&gt;_current_file.replace(0, sub.length(), last_day);

        if (this-&gt;_exist_file(name)) {
            this-&gt;_files.push_back(name);
        }
    }

    vector&lt;string&gt;::iterator it;

    FILE* f;
    while (it != this-&gt;_files.end()) {
        char* line;

        f = fopen(this-&gt;_files[it], &quot;r&quot;);
        fgets(line, 25, f);

        if (line.length() &lt;= 0) {
            remove(this-&gt;_files[it]);
        }

        fclose(f);

        it++;
    }
}

bool Notice::_exist_file(string file) {
    //Schneller: nur Dateiinformationen lesen
    if (GetFileAttributes(file.c_str()) == INVALID_FILE_ATTRIBUTES) {
        return false;
    }

    return true;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/225171/undefinied-reference-to</link><generator>RSS for Node</generator><lastBuildDate>Thu, 01 Oct 2026 18:09:33 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/225171.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 20 Oct 2008 13:35:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Undefinied Reference to... on Mon, 20 Oct 2008 13:35:45 GMT]]></title><description><![CDATA[<p>Ich bekomme jedes mal beim compilieren diese Fehler</p>
<blockquote>
<p>C:\Users\White\AppData\Local\Temp/ccWz4PlV.o:notice.c:(.text+0x12f): undefined reference to `Notice:<br />
:Notice()'<br />
collect2: ld returned 1 exit status</p>
</blockquote>
<p>Ich bin noch relativer Anfänger und hab nun Stunden damit verbracht, rauszufinden was der Fehler heißt bzw. bedeuten mag und wie ich dagegen vorgehen kann, hab nun aber keine Lust mehr bzw. bin am verzweifeln und das hier ist mein letzter Anlauf diese Frage vllt erklärt zu bekommen.</p>
<p>Der Code ist folgender:</p>
<p>notice.c:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &quot;Notice.class.h&quot;

using namespace std;

int main() {
    Notice n;

    /*string command;
    getline(cin, command);

    if (command.substr(0, 3) == &quot;add&quot;) {
        command = command.replace(0, 3, &quot;&quot;);

        n-&gt;addNotice(command);
    } else if (command.substr(0, 4) == &quot;done&quot;) {
        command = command.replace(0, 4, &quot;&quot;);

        n-&gt;remove_notice(command);
    }

    cout &lt;&lt; n-&gt;count_view() &lt;&lt; &quot; Notizen liegen noch vor&quot; &lt;&lt; endl;*/

    //delete n;
}
</code></pre>
<p>Notice.class.h</p>
<pre><code class="language-cpp">#pragma once

#include &lt;time.h&gt;
#include &lt;string.h&gt;
#include &lt;vector&gt;
#include &lt;stdio.h&gt;

using std::string;
using std::vector;

class Notice {
    public:
        Notice();
        bool addNotice(string notice);
        string getNotice(string match, int time_stamp = 0);
        vector&lt;string&gt; getNotice(int time_stamp = 0);
        bool remove_notice(string match, int time_stamp = 0);
        int count_view();
    private:
        bool _exist_notice(string match, int time_stamp = 0);
        bool _exist_file(string file);
        void _clear();
        void _create_date(char* &amp;refer, int timestamp = 0);
        void _write_into(vector&lt;string&gt; output, int time_stamp = 0);

        char* _current_file;
        vector&lt;string&gt; _files;
};
</code></pre>
<p>Notice.class.c</p>
<pre><code class="language-cpp">#include &quot;Notice.class.h&quot;

Notice::Notice() {
    this-&gt;_create_date(this-&gt;_current_file);

    if (!this-&gt;_exist_file(this-&gt;_current_file)) {
        FILE* f = fopen(this-&gt;_current_file, &quot;w+&quot;);
        fclose(f);
    }

    this-&gt;_clear();
}

void Notice::_create_date(char* &amp;refer, int timestamp) {
    time_t cur_time = time(0);
    tm*    timer    = localtime(&amp;cur_time);

    sprintf(
        refer,
        &quot;%d-%d-%d.txt&quot;,
        timer-&gt;tm_mday,
        (timer-&gt;tm_mon + 1),
        (timer-&gt;tm_year + 1900)
    );
}

int Notice::count_view() {
    vector&lt;string&gt;::iterator it;
    int count = 0;

    while (it != this-&gt;_files.end()) {
        count++;

        it++;
    }

    return count;
}

bool Notice::addNotice(string notice) {
    if (!this-&gt;_exist_notice(notice)) {
        FILE* f = fopen(this-&gt;_current_file, &quot;a&quot;);
        fputs(notice.c_str(), f);
        fclose(f);

        return true;
    }

    return false;
}

string getNotice(string match, int time_stamp) {
    int offset = 200;
    char* search;

    this-&gt;_create_date(search, time_stamp);
    if (time_stamp &gt; 0 &amp;&amp; !binary_search(this-&gt;_files.begin(), this-&gt;_files.end(), search)) {
        return null;
    }

    if (time_stamp &lt;= 0) {
        search = this-&gt;_current_file;
    }

    if (!this-&gt;_file_exists(search)) {
        return null;
    }

    FILE* f = fopen(search, &quot;r&quot;);

    char line[offset];
    while (!feof(f)) {
        fgets(line.c_str(), offset, f);

        if (strstr(match.c_str(), line)) {
            return line;
        }
    }

    fclose(f);

    return null;
}

vector&lt;string&gt; Notice::getNotice(int time_stamp) {
    int offset = 200;
    char* search;

    vector&lt;string&gt; output;

    output.reserve(20);
    output.resize(10);

    this-&gt;_create_date(search, time_stamp);
    if (time_stamp &gt; 0 &amp;&amp; !binary_search(this-&gt;_files.begin(), this-&gt;_files.end(), search)) {
        return null;
    }

    if (time_stamp &lt;= 0) {
        search = this-&gt;_current_file;
    }

    if (!this-&gt;_file_exists(search)) {
        return null;
    }

    FILE* f = fopen(search, &quot;r&quot;);

    char line[offset];
    int counter = 0;
    while (!feof(f)) {
        counter++;

        if (counter &gt;= output.size()) {
            output.resize(output.size() + 10);
        }

        fgets(line.c_str(), offset, f);

        if (strlen(line)) {
            output.push_back(line);
        }
    }

    fclose(f);

    return output;
}

bool Notice::_exist_notice(string match, int time_stamp = 0) {
    string search = this-&gt;getNotice(match, time_stamp);

    return search == null ? false : true;
}

bool Notice::remove_notice(string match, int time_stamp) {
    vector&lt;string&gt; output = this-&gt;getNotice(time_stamp);
    vector&lt;string&gt;::iterator it;

    while (it != output.end()) {
        if (output[it].find(match)) {
            it = output.erase(it);

            this-&gt;_write_into(output, time_stamp);

            return true;
        }

        it++;
    }

    return false;
}

void Notice::_write_into(vector&lt;string&gt; output, int time_stamp) {
    char* search;

    if (time_stamp &gt; 0) {
        this-&gt;_create_date(search, time_stamp);
    } else {
        search = this-&gt;_current_file;
    }

    if (!this-&gt;_file_exists(search)) {
        return null;
    }

    FILE* f = fopen(search, &quot;w+&quot;);

    vector&lt;string&gt;::iterator it;
    while (it != output.end()) {
        fputs(output[it], f);

        it++;
    }

    fclose(f);
}

void Notice::_clear() {
    string sub = this-&gt;_current_file.substr(0, this-&gt;_current_file.find(&quot;.&quot;, 0));
    int last_day = timer-&gt;tm_mday;

    this-&gt;_files.resize(5);
    for (int i = 5; i &gt; 0; i++) {
        last_day -= 1;

        string name = this-&gt;_current_file.replace(0, sub.length(), last_day);

        if (this-&gt;_exist_file(name)) {
            this-&gt;_files.push_back(name);
        }
    }

    vector&lt;string&gt;::iterator it;

    FILE* f;
    while (it != this-&gt;_files.end()) {
        char* line;

        f = fopen(this-&gt;_files[it], &quot;r&quot;);
        fgets(line, 25, f);

        if (line.length() &lt;= 0) {
            remove(this-&gt;_files[it]);
        }

        fclose(f);

        it++;
    }
}

bool Notice::_exist_file(string file) {
    //Schneller: nur Dateiinformationen lesen
    if (GetFileAttributes(file.c_str()) == INVALID_FILE_ATTRIBUTES) {
        return false;
    }

    return true;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1601698</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1601698</guid><dc:creator><![CDATA[rswhite]]></dc:creator><pubDate>Mon, 20 Oct 2008 13:35:45 GMT</pubDate></item><item><title><![CDATA[Reply to Undefinied Reference to... on Mon, 20 Oct 2008 14:06:12 GMT]]></title><description><![CDATA[<p>im Grunde bedeuted der Fehler, dass die Definition fehlt, die Deklaration aber vorhanden ist.<br />
Er findet die Implementierung des Konstruktors nicht.<br />
Versuch mal die Endung .cpp anstatt .c</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1601720</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1601720</guid><dc:creator><![CDATA[JustAnotherNoob]]></dc:creator><pubDate>Mon, 20 Oct 2008 14:06:12 GMT</pubDate></item><item><title><![CDATA[Reply to Undefinied Reference to... on Mon, 20 Oct 2008 14:23:57 GMT]]></title><description><![CDATA[<p>Weiß Dein Compiler wo sich die gebrauchte Header Datei befindet?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1601734</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1601734</guid><dc:creator><![CDATA[XHansWurstX]]></dc:creator><pubDate>Mon, 20 Oct 2008 14:23:57 GMT</pubDate></item><item><title><![CDATA[Reply to Undefinied Reference to... on Mon, 20 Oct 2008 14:27:48 GMT]]></title><description><![CDATA[<p>XHansWurstX schrieb:</p>
<blockquote>
<p>Weiß Dein Compiler wo sich die gebrauchte Header Datei befindet?</p>
</blockquote>
<p>DAs hat doch mit der Fehlermeldung nichts zutun! Der Header wird gefunden, sonst hätte es geheißen, das er den Header nicht findet... logisch, oder?<br />
Außerdem ist es ein LINKER-Fehler und kein Präprozessor-Fehler.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1601736</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1601736</guid><dc:creator><![CDATA[Bulli]]></dc:creator><pubDate>Mon, 20 Oct 2008 14:27:48 GMT</pubDate></item><item><title><![CDATA[Reply to Undefinied Reference to... on Mon, 20 Oct 2008 14:28:11 GMT]]></title><description><![CDATA[<p>XHansWurstX schrieb:</p>
<blockquote>
<p>Weiß Dein Compiler wo sich die gebrauchte Header Datei befindet?</p>
</blockquote>
<p>Am Header liegt es nicht, sonst würde ja schon die include-Anweisung fehlschlagen. Ihm fehlt die Implementierung, d.h. er deklariert im Header Funktionen, deren Definition nicht gefunden wird. Wurde ja schon gesagt...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1601738</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1601738</guid><dc:creator><![CDATA[_matze]]></dc:creator><pubDate>Mon, 20 Oct 2008 14:28:11 GMT</pubDate></item><item><title><![CDATA[Reply to Undefinied Reference to... on Mon, 20 Oct 2008 14:28:32 GMT]]></title><description><![CDATA[<p>naja die Notice.Class.h sollte in deinem fall direkt in deinem projektverzeichnis liegen...</p>
<p>Bin mir aber nicht ganz sicher inwiefern das Ding zwei Punkte in Dateinamen akzeptiert. Sollte aber theoretisch funzen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1601739</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1601739</guid><dc:creator><![CDATA[It0101]]></dc:creator><pubDate>Mon, 20 Oct 2008 14:28:32 GMT</pubDate></item><item><title><![CDATA[Reply to Undefinied Reference to... on Mon, 20 Oct 2008 14:45:19 GMT]]></title><description><![CDATA[<p>It0101 schrieb:</p>
<blockquote>
<p>naja die Notice.Class.h sollte in deinem fall direkt in deinem projektverzeichnis liegen...</p>
<p>Bin mir aber nicht ganz sicher inwiefern das Ding zwei Punkte in Dateinamen akzeptiert. Sollte aber theoretisch funzen.</p>
</blockquote>
<p>Ich glaube, man kann jeden Scheiß im Dateinamen verwenden. Alles, was in Dateinamen halt so erlaubt ist. Du kannst ja auch Nicht-Header-Dateien inkludieren (.c, .cpp, .txt, .wasweissich)...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1601751</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1601751</guid><dc:creator><![CDATA[_matze]]></dc:creator><pubDate>Mon, 20 Oct 2008 14:45:19 GMT</pubDate></item><item><title><![CDATA[Reply to Undefinied Reference to... on Mon, 20 Oct 2008 15:44:21 GMT]]></title><description><![CDATA[<p>Nur das bei der Endung .c manche Compiler versuchen C zu kompilieren statt C++. Das gibt dann natürlich Probleme.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1601789</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1601789</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Mon, 20 Oct 2008 15:44:21 GMT</pubDate></item><item><title><![CDATA[Reply to Undefinied Reference to... on Mon, 20 Oct 2008 16:25:28 GMT]]></title><description><![CDATA[<p>Hab ich nun mal geändert. Beide c Dateien sind nun cpp Dateien, doch wieder sowas:</p>
<blockquote>
<p>C:\Users\White\Desktop&gt;g++ -o notice.exe notice.cpp<br />
C:\Users\White\AppData\Local\Temp/cc783PJK.o:notice.cpp:(.text+0x12f): undefined reference to `Notic<br />
e::Notice()'<br />
collect2: ld returned 1 exit status</p>
</blockquote>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":/"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1601807</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1601807</guid><dc:creator><![CDATA[rswhite]]></dc:creator><pubDate>Mon, 20 Oct 2008 16:25:28 GMT</pubDate></item><item><title><![CDATA[Reply to Undefinied Reference to... on Mon, 20 Oct 2008 17:01:39 GMT]]></title><description><![CDATA[<p>wenn du es so kompilierst, ist ja klar.<br />
Du musst schon beide cpp Dateien angebenoO</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1601831</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1601831</guid><dc:creator><![CDATA[JustAnotherNoob]]></dc:creator><pubDate>Mon, 20 Oct 2008 17:01:39 GMT</pubDate></item><item><title><![CDATA[Reply to Undefinied Reference to... on Mon, 20 Oct 2008 17:10:53 GMT]]></title><description><![CDATA[<p>JustAnotherNoob schrieb:</p>
<blockquote>
<p>wenn du es so kompilierst, ist ja klar.<br />
Du musst schon beide cpp Dateien angebenoO</p>
</blockquote>
<p>und das mache ich wie?</p>
<pre><code>g++ -o notice.exe notice.class.exe notice.cpp notice.class.cpp
</code></pre>
<p>oder wie?<br />
wieso is das eigentlich wichtig, die wird doch per include eingelesen dachte ich.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1601838</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1601838</guid><dc:creator><![CDATA[rswhite]]></dc:creator><pubDate>Mon, 20 Oct 2008 17:10:53 GMT</pubDate></item><item><title><![CDATA[Reply to Undefinied Reference to... on Mon, 20 Oct 2008 17:27:13 GMT]]></title><description><![CDATA[<p>Nein, inkludiert werden nur die Header-Dateien, die du in deinen Sourcen inkludierst. Und CPP-Dateien werden nicht inkludiert! Auch nicht im Source.</p>
<p>CPP-Dateien sind sogenannte Übersetzungseinheiten. D.h. man übersetzt immer eine CPP-Datei für sich alleine. Aus jeder CPP-Datei wird eine OBJ-Datei (Object = übersetze Einheit). Am Ende werden alle OBJ-Dateien vom Linker zu einer EXE gelinkt (verbunden).</p>
<p>So, d.h. der Linker sucht alle OBJ-Dateien zusammen und löst die übersetzten Referenzen (Funktionen, Klassen usw.) auf. Fehlt eine übersetzte Referenz, gibts einen Error. Und den hast du ja ebend erhalten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1601857</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1601857</guid><dc:creator><![CDATA[Bulli]]></dc:creator><pubDate>Mon, 20 Oct 2008 17:27:13 GMT</pubDate></item><item><title><![CDATA[Reply to Undefinied Reference to... on Mon, 20 Oct 2008 18:00:32 GMT]]></title><description><![CDATA[<p>Aso, wieder was gelernt <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /><br />
Also muss ich jetzt beide cpp Dateien für sich compilieren oder wie?<br />
also</p>
<pre><code>g++ -o notice.exe notice.cpp
</code></pre>
<pre><code>g++ -o notice.class.exe notice.class.cpp
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1601883</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1601883</guid><dc:creator><![CDATA[rswhite]]></dc:creator><pubDate>Mon, 20 Oct 2008 18:00:32 GMT</pubDate></item><item><title><![CDATA[Reply to Undefinied Reference to... on Mon, 20 Oct 2008 18:07:46 GMT]]></title><description><![CDATA[<p>du willst ja nur eine .exe<br />
entweder so:<br />
g++ -onotice.exe notice.cpp notice.class.cpp<br />
oder so(Der Vorteil hierbei ist, dass man einzeln steuern kann was kompiliert wird und man dadurch Zeitspaart. Stichwort Gnu Make, oder ähnliche Buildsysteme):<br />
g++ -c notice.cpp<br />
g++ -c notice.class.cpp<br />
g++ -onotice.exe notice.o notice.class.o</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1601887</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1601887</guid><dc:creator><![CDATA[JustAnotherNoob]]></dc:creator><pubDate>Mon, 20 Oct 2008 18:07:46 GMT</pubDate></item><item><title><![CDATA[Reply to Undefinied Reference to... on Mon, 20 Oct 2008 19:47:01 GMT]]></title><description><![CDATA[<blockquote>
<p>Aso, wieder was gelernt<br />
Also muss ich jetzt beide cpp Dateien für sich compilieren oder wie?</p>
</blockquote>
<p>Dein Kommando war falsch, aber JustAnotherNoob hat es richtig gestellt. Du kannst natürlich auch alle CPP-Dateien in einem Rutsch mitgeben. Aber du mußt halt wissen, das der Compiler es am Ende halt trotzdem einzeln kompiliert.</p>
<p>Aber eines wird dann deutlich:</p>
<pre><code>g++ -c notice.cpp 
g++ -c notice.class.cpp
</code></pre>
<p>Hier werden die Übersetzungseinheiten einzeln kompiliert und der Compiler erzeugt Objekt-Dateien. (da steht der kompilierte Code drin)<br />
Und dann können die Objekt-Dateien verlinkt werden:</p>
<pre><code>g++ -o notice.exe notice.o notice.class.o
</code></pre>
<p>Folgendes ist natürlich nur eine kürzere Variante:</p>
<pre><code>g++ -o notice.exe notice.cpp notice.class.cpp
</code></pre>
<p>Aber mit dem kompilieren <em>einzelner</em> Übersetzungseinheiten wird einem erstmal bewusst, wie eigentlich das CPP- und Header-Konzept funktioniert! Man geht immer von einer CPP-Datei aus, die nur Headers inkludiert.<br />
Die CPP-Datei ist also ein Modul, halt eine Einheit die für sich alleine besteht. Durch die Headers bekommt man nur eine schwache Abhängigkeit zu anderen Übersetzungseinheiten. Das ist wichtig, damit man keine starke Abhängigkeit zwischen Übersetzungseinheiten aufbaut - sonst ist das Modulkonzept nicht haltbar.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1601926</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1601926</guid><dc:creator><![CDATA[Bulli]]></dc:creator><pubDate>Mon, 20 Oct 2008 19:47:01 GMT</pubDate></item><item><title><![CDATA[Reply to Undefinied Reference to... on Tue, 21 Oct 2008 08:34:41 GMT]]></title><description><![CDATA[<p>Gut vielen Dank für die Lektion <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1602056</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1602056</guid><dc:creator><![CDATA[rswhite]]></dc:creator><pubDate>Tue, 21 Oct 2008 08:34:41 GMT</pubDate></item></channel></rss>