<?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[multiple definitions ????]]></title><description><![CDATA[<p>Hey nutze wxdev-cpp-c++</p>
<p>habe folgenden code geschrieben und kenne mich nicht so gut mit klassen und co aus.</p>
<p>habe immer folgenden fehlermeldungen:</p>
<p>multiple definition of `dreieck::berechneFlaeche()'<br />
first defined here</p>
<p>habe mehrere klassen die jeweils gleichnamige methoden haben.<br />
geht das nicht? müssen die unterschiedliche namen haben??</p>
<pre><code class="language-cpp">float dreieck::berechneFlaeche(){
drhoehe=(seiteg/2)*(seiteg/2) + seiteb*seiteb;
drflaeche= ::std::sqrt(drhoehe) * seiteg /2;
return drflaeche;
}
</code></pre>
<p>und diese funktion jeweils noch für andere formen und körper....<br />
weiß jemand wo das problem liegt?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/149030/multiple-definitions</link><generator>RSS for Node</generator><lastBuildDate>Sat, 05 Sep 2026 02:32:55 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/149030.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 01 Jun 2006 13:38:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to multiple definitions ???? on Thu, 01 Jun 2006 13:38:31 GMT]]></title><description><![CDATA[<p>Hey nutze wxdev-cpp-c++</p>
<p>habe folgenden code geschrieben und kenne mich nicht so gut mit klassen und co aus.</p>
<p>habe immer folgenden fehlermeldungen:</p>
<p>multiple definition of `dreieck::berechneFlaeche()'<br />
first defined here</p>
<p>habe mehrere klassen die jeweils gleichnamige methoden haben.<br />
geht das nicht? müssen die unterschiedliche namen haben??</p>
<pre><code class="language-cpp">float dreieck::berechneFlaeche(){
drhoehe=(seiteg/2)*(seiteg/2) + seiteb*seiteb;
drflaeche= ::std::sqrt(drhoehe) * seiteg /2;
return drflaeche;
}
</code></pre>
<p>und diese funktion jeweils noch für andere formen und körper....<br />
weiß jemand wo das problem liegt?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1069601</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1069601</guid><dc:creator><![CDATA[Inso]]></dc:creator><pubDate>Thu, 01 Jun 2006 13:38:31 GMT</pubDate></item><item><title><![CDATA[Reply to multiple definitions ???? on Thu, 01 Jun 2006 13:40:42 GMT]]></title><description><![CDATA[<p>Wo steht denn dieser Code? Etwa in einer Headerdatei?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1069602</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1069602</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Thu, 01 Jun 2006 13:40:42 GMT</pubDate></item><item><title><![CDATA[Reply to multiple definitions ???? on Thu, 01 Jun 2006 13:44:04 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<blockquote>
<p>müssen die unterschiedliche namen haben??</p>
</blockquote>
<p>nein, müssen sie nicht:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

struct A {
  void foo();
};

void A::foo() { std::cout&lt;&lt;&quot;A says hello&quot;&lt;&lt;std::endl; };

struct B {
  void foo();
};

void B::foo() { std::cout&lt;&lt;&quot;B says hello&quot;&lt;&lt;std::endl; };

//...
A a;
B b;

a.foo();
b.foo();
</code></pre>
<p>Aber ein bisschen Code im Kontext von dir könnte helfen, denn sonst können wir nur raten.</p>
<p>MfG</p>
<p>GPC</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1069603</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1069603</guid><dc:creator><![CDATA[GPC]]></dc:creator><pubDate>Thu, 01 Jun 2006 13:44:04 GMT</pubDate></item><item><title><![CDATA[Reply to multiple definitions ???? on Thu, 01 Jun 2006 14:20:24 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile.php?mode=viewprofile&amp;u=10455" rel="nofollow">evilissimo</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=51" rel="nofollow">Andere GUIs - Qt, GTK+, wxWidgets</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=15" rel="nofollow">C++</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic.php?t=39405" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1069628</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1069628</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Thu, 01 Jun 2006 14:20:24 GMT</pubDate></item><item><title><![CDATA[Reply to multiple definitions ???? on Thu, 01 Jun 2006 14:43:11 GMT]]></title><description><![CDATA[<p>so schaut die .cpp datei aus</p>
<pre><code class="language-cpp">//--dreieck.cpp
#include &quot;dreieck.h&quot;
#include &lt;cmath&gt;

float drumfang,drflaeche, drhoehe;
float dreieck::berechneUmfang(){
drumfang=seiteg+seiteb+seitec;
return drumfang;
}
float dreieck::berechneFlaeche(){
drhoehe=(seiteg/2)*(seiteg/2) + seiteb*seiteb;
drflaeche= ::std::sqrt(drhoehe) * seiteg /2;
return drflaeche;
}
void dreieck::setzeSeiten(float a, float s){
seiteg=a;
seiteb=s;
seitec=seiteb;
}
</code></pre>
<p>und so die dazugehörige headerdatei</p>
<pre><code class="language-cpp">class dreieck {
public:   float dreieck::berechneUmfang();
          float dreieck::berechneFlaeche();
          void dreieck::setzeSeiten(float a, float s);
private:  float seiteg, seiteb, seitec;
};
</code></pre>
<p>hatte vorher in der headerdatei noch ifndef drin....<br />
dadran liegts auch nicht...</p>
<p>und die klasse dreieck ist halt nur eine von vielen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1069647</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1069647</guid><dc:creator><![CDATA[Inso]]></dc:creator><pubDate>Thu, 01 Jun 2006 14:43:11 GMT</pubDate></item><item><title><![CDATA[Reply to multiple definitions ???? on Thu, 01 Jun 2006 16:15:18 GMT]]></title><description><![CDATA[<p>erledigt.<br />
hatte anstatt die h-datei die cpp datei included in dem mainfile.... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1069703</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1069703</guid><dc:creator><![CDATA[Inso]]></dc:creator><pubDate>Thu, 01 Jun 2006 16:15:18 GMT</pubDate></item><item><title><![CDATA[Reply to multiple definitions ???? on Thu, 01 Jun 2006 16:26:17 GMT]]></title><description><![CDATA[<p>Inso schrieb:</p>
<blockquote>
<pre><code class="language-cpp">class dreieck {
public:   float dreieck::berechneUmfang();
          float dreieck::berechneFlaeche();
          void dreieck::setzeSeiten(float a, float s);
private:  float seiteg, seiteb, seitec;
};
</code></pre>
</blockquote>
<p>das hier ist trotzdem...komisch, was machen die dreieck:: Bezeichner da vor den Methoden? Braucht man nicht.</p>
<p>MfG</p>
<p>GPC</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1069707</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1069707</guid><dc:creator><![CDATA[GPC]]></dc:creator><pubDate>Thu, 01 Jun 2006 16:26:17 GMT</pubDate></item><item><title><![CDATA[Reply to multiple definitions ???? on Fri, 02 Jun 2006 06:35:03 GMT]]></title><description><![CDATA[<p>Inso schrieb:</p>
<blockquote>
<p>hatte vorher in der headerdatei noch ifndef drin....<br />
dadran liegts auch nicht...</p>
</blockquote>
<p>Ja, die Include-Guards schützen auch nur davor, daß der Compiler mehrere Definitionen in einer Übersetzungseinheit zu Gesicht bekommt. Dein Fehler stammt daher, daß der Linker mehrere Definitionen erhalten hat (aus verschiedenen Übersetzungseinheiten) - und das verhindert man nur, indem man die Funktionen in eine eigene CPP auslagert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1069881</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1069881</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Fri, 02 Jun 2006 06:35:03 GMT</pubDate></item></channel></rss>