<?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 definition of ..]]></title><description><![CDATA[<p>ich habe eine headerdatei, die ich extra mit diesen verdammten makros versehen habe, damit es keine probleme mit mehrfachdeklarationen gibt...<br />
aber sobald ich diese datei in 2 klassen einbinde, die diese funktionen benötigen meckert der compiler:</p>
<pre><code>In function `get_rand_nmb(unsigned short, bool)':
../global_fkt.h:9: multiple definition of `get_rand_nmb(unsigned short, bool)'
build/../global_fkt.h:9: first defined here
</code></pre>
<pre><code class="language-cpp">#ifndef GLOABELFKTS_h
#define GLOABELFKTS_h

#include &lt;iostream&gt;
#include &lt;cstdlib&gt;
#include &lt;math.h&gt;
#include &lt;ctime&gt;

float get_rand_nmb(unsigned short range, bool negative = false)
{
	float zahl;
	if(negative)
		zahl = (rand() % range) - range/2;
	else zahl = rand() % range;

	return zahl;
}
...

#endif
</code></pre>
<p>wie umgehe ich das elegant? ich möchte weiterhin in beide dateien diese header einbinden.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/212301/multiple-definition-of</link><generator>RSS for Node</generator><lastBuildDate>Wed, 14 Oct 2026 17:24:12 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/212301.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 04 May 2008 14:01:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to multiple definition of .. on Sun, 04 May 2008 14:01:43 GMT]]></title><description><![CDATA[<p>ich habe eine headerdatei, die ich extra mit diesen verdammten makros versehen habe, damit es keine probleme mit mehrfachdeklarationen gibt...<br />
aber sobald ich diese datei in 2 klassen einbinde, die diese funktionen benötigen meckert der compiler:</p>
<pre><code>In function `get_rand_nmb(unsigned short, bool)':
../global_fkt.h:9: multiple definition of `get_rand_nmb(unsigned short, bool)'
build/../global_fkt.h:9: first defined here
</code></pre>
<pre><code class="language-cpp">#ifndef GLOABELFKTS_h
#define GLOABELFKTS_h

#include &lt;iostream&gt;
#include &lt;cstdlib&gt;
#include &lt;math.h&gt;
#include &lt;ctime&gt;

float get_rand_nmb(unsigned short range, bool negative = false)
{
	float zahl;
	if(negative)
		zahl = (rand() % range) - range/2;
	else zahl = rand() % range;

	return zahl;
}
...

#endif
</code></pre>
<p>wie umgehe ich das elegant? ich möchte weiterhin in beide dateien diese header einbinden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1503105</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1503105</guid><dc:creator><![CDATA[gotthard]]></dc:creator><pubDate>Sun, 04 May 2008 14:01:43 GMT</pubDate></item><item><title><![CDATA[Reply to multiple definition of .. on Sun, 04 May 2008 14:04:36 GMT]]></title><description><![CDATA[<p>inline</p>
<p>&lt;math.h&gt; -&gt; &lt;cmath&gt; (&lt;math.h&gt; ist nicht falsch, passt aber nicht so richtig)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1503107</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1503107</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Sun, 04 May 2008 14:04:36 GMT</pubDate></item><item><title><![CDATA[Reply to multiple definition of .. on Sun, 04 May 2008 14:09:26 GMT]]></title><description><![CDATA[<p>krass, danke, ich wusste noch gar nicht so genau wofür inline alles gut ist^^</p>
<p>das mit cmath, hatte ich vergessen, ist wohl bisherige gewohnheit gewesen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1503109</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1503109</guid><dc:creator><![CDATA[gotthard]]></dc:creator><pubDate>Sun, 04 May 2008 14:09:26 GMT</pubDate></item></channel></rss>