<?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[Anfängerfrage: Linker error]]></title><description><![CDATA[<p>Hallo allerseits</p>
<p>Muss eine eigentlich einfache Übung in objektorientierter Programmierung lösen. Das Programm ist aufgeteilt in ein Header-, Main- und Implementierungsfile. Beim Compilieren erhalte ich nun immer die Fehlermeldung &quot;[Linker error] undefined reference to `Point::Point(double, double)'&quot;. Ich verwende Dev C++ Vers. 4.9. Kann mir bei diesem Problem vielleicht jemand weiterhelfen?</p>
<p>main.cpp</p>
<pre><code>#include &quot;header.h&quot;

int main()
{
    double dx(0), dy(0), axValue(2);
    Point p1(0,0);
    cout&lt;&lt;&quot;x und y Werte eingeben: \n&quot;;
    cin&gt;&gt;dx;
    cin&gt;&gt;dy;
    p1.setPoint(dx,dy);
    cout&lt;&lt;&quot;Die Achse um &quot;&lt;&lt;axValue&lt;&lt;&quot; verschieben&quot;&lt;&lt;endl;
    p1.shiftAxis(axValue);
    cout&lt;&lt;&quot;\nPosition von P1: x= &quot;&lt;&lt;p1.getX()&lt;&lt;&quot; y= &quot;&lt;&lt;p1.getY()&lt;&lt;endl;
    Point p2(p1);
    cout&lt;&lt;&quot;\nPosition von p2: &quot;&lt;&lt;endl;
    p2.showPoint();
    system(&quot;PAUSE&quot;);
    return 0;
}
</code></pre>
<p>koordinaten.cpp:</p>
<pre><code>#include &quot;header.h&quot;

void Point::setPoint(double x,double y){
     _x=x;
     _y=y;
}
void Point::showPoint (){
     cout&lt;&lt;_x&lt;&lt;&quot; &quot;&lt;&lt;_y&lt;&lt;endl;
}
double Point::getX(){
       return _x;
}
double Point::getY(){
       return _y;
}
void Point::shiftAxis (double value){
     _x=_x+value;
     _y=_y+value;
}
</code></pre>
<p>header.h:</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;math.h&gt;

using namespace std;

class Point{
      public:
             Point (double x,double y);
             Point (const Point &amp;P);
             void setPoint(double x,double y);
             void showPoint();
             double getX();
             double getY();
             void shiftAxis (double value);
      private:
              double _x;
              double _y;
};
</code></pre>
<p>Danke für eure Hilfe!! <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>
<p>Gruss<br />
David</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/207567/anfängerfrage-linker-error</link><generator>RSS for Node</generator><lastBuildDate>Sun, 11 Oct 2026 07:01:16 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/207567.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 09 Mar 2008 12:21:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Anfängerfrage: Linker error on Sun, 09 Mar 2008 12:21:35 GMT]]></title><description><![CDATA[<p>Hallo allerseits</p>
<p>Muss eine eigentlich einfache Übung in objektorientierter Programmierung lösen. Das Programm ist aufgeteilt in ein Header-, Main- und Implementierungsfile. Beim Compilieren erhalte ich nun immer die Fehlermeldung &quot;[Linker error] undefined reference to `Point::Point(double, double)'&quot;. Ich verwende Dev C++ Vers. 4.9. Kann mir bei diesem Problem vielleicht jemand weiterhelfen?</p>
<p>main.cpp</p>
<pre><code>#include &quot;header.h&quot;

int main()
{
    double dx(0), dy(0), axValue(2);
    Point p1(0,0);
    cout&lt;&lt;&quot;x und y Werte eingeben: \n&quot;;
    cin&gt;&gt;dx;
    cin&gt;&gt;dy;
    p1.setPoint(dx,dy);
    cout&lt;&lt;&quot;Die Achse um &quot;&lt;&lt;axValue&lt;&lt;&quot; verschieben&quot;&lt;&lt;endl;
    p1.shiftAxis(axValue);
    cout&lt;&lt;&quot;\nPosition von P1: x= &quot;&lt;&lt;p1.getX()&lt;&lt;&quot; y= &quot;&lt;&lt;p1.getY()&lt;&lt;endl;
    Point p2(p1);
    cout&lt;&lt;&quot;\nPosition von p2: &quot;&lt;&lt;endl;
    p2.showPoint();
    system(&quot;PAUSE&quot;);
    return 0;
}
</code></pre>
<p>koordinaten.cpp:</p>
<pre><code>#include &quot;header.h&quot;

void Point::setPoint(double x,double y){
     _x=x;
     _y=y;
}
void Point::showPoint (){
     cout&lt;&lt;_x&lt;&lt;&quot; &quot;&lt;&lt;_y&lt;&lt;endl;
}
double Point::getX(){
       return _x;
}
double Point::getY(){
       return _y;
}
void Point::shiftAxis (double value){
     _x=_x+value;
     _y=_y+value;
}
</code></pre>
<p>header.h:</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;math.h&gt;

using namespace std;

class Point{
      public:
             Point (double x,double y);
             Point (const Point &amp;P);
             void setPoint(double x,double y);
             void showPoint();
             double getX();
             double getY();
             void shiftAxis (double value);
      private:
              double _x;
              double _y;
};
</code></pre>
<p>Danke für eure Hilfe!! <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>
<p>Gruss<br />
David</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1470927</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1470927</guid><dc:creator><![CDATA[fewi18]]></dc:creator><pubDate>Sun, 09 Mar 2008 12:21:35 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage: Linker error on Sun, 09 Mar 2008 12:24:00 GMT]]></title><description><![CDATA[<p>Du hast den Konstruktor nicht implementiert</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1470928</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1470928</guid><dc:creator><![CDATA[JustAnotherNoob]]></dc:creator><pubDate>Sun, 09 Mar 2008 12:24:00 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage: Linker error on Sun, 09 Mar 2008 13:08:51 GMT]]></title><description><![CDATA[<p>JustAnotherNoob schrieb:</p>
<blockquote>
<p>Du hast den Konstruktor nicht implementiert</p>
</blockquote>
<p>genau so sieht das aus... deklariert hast du ihn, aber die definition steht noch aus. die methoden hingegen hast du brav definiert <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";-)"
      alt="😉"
    /><br />
und benutze doch bitte das nächste mal den &quot;C/C++&quot; tag anstelle des &quot;Code&quot;-Tags. ist etwas verwirrend, sieht aber schoener aus</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1470950</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1470950</guid><dc:creator><![CDATA[muffmolch]]></dc:creator><pubDate>Sun, 09 Mar 2008 13:08:51 GMT</pubDate></item></channel></rss>