<?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[Kann eine .h Datei nicht includen]]></title><description><![CDATA[<p>Hallo</p>
<p>bin neu hier.</p>
<p>Ich habe aus einem C++ buch folgenden Code abgeschrieben:</p>
<p>Ich habe eine <strong>ort1.h</strong> Datei:</p>
<pre><code>#ifndef ort1_h
#define ort1_h ort1_h

class Ort1 {
    public:
        int X() const;
        int Y() const;
        void aendern (int x, int y);
    private:
        int xKoordinate,
            yKoordinate;
}; 
#endif
</code></pre>
<p>und die möchte ich in der <strong>ort1main.cpp</strong> includen:</p>
<pre><code>#include &quot;ort1.h&quot;
#include &lt;cstdlib&gt;
#include &lt;iostream&gt;

using namespace std;

int main(int argc, char *argv[])
{
    Ort1 einOrt1;
    einOrt1.aendern(100, 200);
    cout &lt;&lt; &quot;Der Ort hat die Koorinaten x = &quot; &lt;&lt; einOrt1.X() &lt;&lt; &quot; und y = &quot; &lt;&lt; einOrt1.Y() &lt;&lt; endl;
    system(&quot;PAUSE&quot;);
    return EXIT_SUCCESS;
}
</code></pre>
<p>Geht aber nich. keine Ahnung wieso. Es lässt sich nicht kompillieren. Ich bekomme folgende Fehlermeldungen:</p>
<pre><code>[Linker error] undefined reference to `Ort1::aendern(int, int)' 
  [Linker error] undefined reference to `Ort1::Y() const' 
  [Linker error] undefined reference to `Ort1::X() const' 
  ld returned 1 exit status 
 G:\programmieren\cpp\buch\5.2\Ort1\Makefile.win [Build Error]  [ort1.exe] Error 1
</code></pre>
<p>Kann mir jemand bitte helfen? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>PS: Ich arbeite mit Bloodshed Dev-C++</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/124331/kann-eine-h-datei-nicht-includen</link><generator>RSS for Node</generator><lastBuildDate>Sun, 23 Aug 2026 21:55:03 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/124331.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 26 Oct 2005 15:09:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Kann eine .h Datei nicht includen on Wed, 26 Oct 2005 15:09:44 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>bin neu hier.</p>
<p>Ich habe aus einem C++ buch folgenden Code abgeschrieben:</p>
<p>Ich habe eine <strong>ort1.h</strong> Datei:</p>
<pre><code>#ifndef ort1_h
#define ort1_h ort1_h

class Ort1 {
    public:
        int X() const;
        int Y() const;
        void aendern (int x, int y);
    private:
        int xKoordinate,
            yKoordinate;
}; 
#endif
</code></pre>
<p>und die möchte ich in der <strong>ort1main.cpp</strong> includen:</p>
<pre><code>#include &quot;ort1.h&quot;
#include &lt;cstdlib&gt;
#include &lt;iostream&gt;

using namespace std;

int main(int argc, char *argv[])
{
    Ort1 einOrt1;
    einOrt1.aendern(100, 200);
    cout &lt;&lt; &quot;Der Ort hat die Koorinaten x = &quot; &lt;&lt; einOrt1.X() &lt;&lt; &quot; und y = &quot; &lt;&lt; einOrt1.Y() &lt;&lt; endl;
    system(&quot;PAUSE&quot;);
    return EXIT_SUCCESS;
}
</code></pre>
<p>Geht aber nich. keine Ahnung wieso. Es lässt sich nicht kompillieren. Ich bekomme folgende Fehlermeldungen:</p>
<pre><code>[Linker error] undefined reference to `Ort1::aendern(int, int)' 
  [Linker error] undefined reference to `Ort1::Y() const' 
  [Linker error] undefined reference to `Ort1::X() const' 
  ld returned 1 exit status 
 G:\programmieren\cpp\buch\5.2\Ort1\Makefile.win [Build Error]  [ort1.exe] Error 1
</code></pre>
<p>Kann mir jemand bitte helfen? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>PS: Ich arbeite mit Bloodshed Dev-C++</p>
]]></description><link>https://www.c-plusplus.net/forum/post/901252</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/901252</guid><dc:creator><![CDATA[delay]]></dc:creator><pubDate>Wed, 26 Oct 2005 15:09:44 GMT</pubDate></item><item><title><![CDATA[Reply to Kann eine .h Datei nicht includen on Wed, 26 Oct 2005 15:14:22 GMT]]></title><description><![CDATA[<p>Hallo,<br />
das sind Linkerfehler. Mit der Inkludierung der Header-Datei hat das Problem nichts zu tun. Was fehlt sind die Definitionen der in der Header-Datei deklarierten Methoden. Du hast also die entsprechende cpp-Datei nicht übersetzt bzw. mitgelinkt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/901258</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/901258</guid><dc:creator><![CDATA[HumeSikkins]]></dc:creator><pubDate>Wed, 26 Oct 2005 15:14:22 GMT</pubDate></item><item><title><![CDATA[Reply to Kann eine .h Datei nicht includen on Wed, 26 Oct 2005 15:17:09 GMT]]></title><description><![CDATA[<p>danke sehr. währe ich nicht selber draufgekommen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/901262</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/901262</guid><dc:creator><![CDATA[delay]]></dc:creator><pubDate>Wed, 26 Oct 2005 15:17:09 GMT</pubDate></item></channel></rss>