<?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[c und C++ mischen (compiler fehler)]]></title><description><![CDATA[<p>Hallo,<br />
mal wieder ne Frage <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>ich habe ein C++ programm und möchte habe eine nützliche Funktion bekommen,<br />
die in C geschrieben ist.<br />
Nun kann ich diese nicht nutzen weil immer ein Linkerfehler kommt<br />
error LNK1120: 1 unaufgeloeste externe Verweise (VC++ 6.0 WinXP)</p>
<p>Ok ich habe schon im internet gefunden das man c und c++ nicht so einfach mischen darf, das man manchmal die c datei einfach in cpp umnennt, neu kompiliert und gut ist.</p>
<p>Aber ich kann die c datei nicht als cpp neu kompilieren, da treten dann noch andere fehler auf.</p>
<p>Meine Frage ist jetzt:</p>
<p>Gibt es noch eine Möglichkeit den Quellcode einzufügen, so das dann alle ohne Linkerfehler zusammengebaut wird?</p>
<p>Vielen Dank schon mal für Tips<br />
und viele Grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/121680/c-und-c-mischen-compiler-fehler</link><generator>RSS for Node</generator><lastBuildDate>Sat, 22 Aug 2026 19:22:38 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/121680.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 26 Sep 2005 14:10:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to c und C++ mischen (compiler fehler) on Mon, 26 Sep 2005 14:10:20 GMT]]></title><description><![CDATA[<p>Hallo,<br />
mal wieder ne Frage <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>ich habe ein C++ programm und möchte habe eine nützliche Funktion bekommen,<br />
die in C geschrieben ist.<br />
Nun kann ich diese nicht nutzen weil immer ein Linkerfehler kommt<br />
error LNK1120: 1 unaufgeloeste externe Verweise (VC++ 6.0 WinXP)</p>
<p>Ok ich habe schon im internet gefunden das man c und c++ nicht so einfach mischen darf, das man manchmal die c datei einfach in cpp umnennt, neu kompiliert und gut ist.</p>
<p>Aber ich kann die c datei nicht als cpp neu kompilieren, da treten dann noch andere fehler auf.</p>
<p>Meine Frage ist jetzt:</p>
<p>Gibt es noch eine Möglichkeit den Quellcode einzufügen, so das dann alle ohne Linkerfehler zusammengebaut wird?</p>
<p>Vielen Dank schon mal für Tips<br />
und viele Grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/post/880478</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/880478</guid><dc:creator><![CDATA[NoobCoder]]></dc:creator><pubDate>Mon, 26 Sep 2005 14:10:20 GMT</pubDate></item><item><title><![CDATA[Reply to c und C++ mischen (compiler fehler) on Mon, 26 Sep 2005 14:15:34 GMT]]></title><description><![CDATA[<p>am besten postest du mal deinen quelltext und die genaue Fehlermeldung,<br />
dann kann man auch leichter etwas zu dem tatsächlichen Problem sagen <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="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/880480</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/880480</guid><dc:creator><![CDATA[k1ro]]></dc:creator><pubDate>Mon, 26 Sep 2005 14:15:34 GMT</pubDate></item><item><title><![CDATA[Reply to c und C++ mischen (compiler fehler) on Mon, 26 Sep 2005 14:20:35 GMT]]></title><description><![CDATA[<p>Fuer mich hoert sich das eher danach an, dass die von dem C-Code erzeugte Lib. nicht eingebunden ist.</p>
<p>BTW: Ich selber mische relativ haeufig C und C++. Dabei schreibe ich mein C so, dass es ohne Warnings C++ compliert werden kann. C++ hat ein strikteres Type-Handling. Man muss also mit einigen cast arbeiten, nur muss man dann acuh genau wissen, was man tut.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/880486</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/880486</guid><dc:creator><![CDATA[MBCS-CITP]]></dc:creator><pubDate>Mon, 26 Sep 2005 14:20:35 GMT</pubDate></item><item><title><![CDATA[Reply to c und C++ mischen (compiler fehler) on Mon, 26 Sep 2005 14:23:06 GMT]]></title><description><![CDATA[<p>Also der Linkerfehlertext:</p>
<p>[quote]<br />
Linker-Vorgang läuft...<br />
dimer.obj : error LNK2001: Nichtaufgeloestes externes Symbol &quot;double __cdecl random(void)&quot; (?random@@YANXZ)<br />
microtubule.obj : error LNK2001: Nichtaufgeloestes externes Symbol &quot;double __cdecl random(void)&quot; (?random@@YANXZ)<br />
Debug/nano.exe : fatal error LNK1120: 1 unaufgeloeste externe Verweise<br />
Fehler beim Ausführen von link.exe.<br />
[/quote]</p>
<p>Der quelltext der c-datei (für lange zufallszahlen)</p>
<pre><code class="language-cpp">/*
c	A random number generator called as a function by
c	random (iseed)	or	irandm (iseed)
c	The parameter should be a pointer to a 2-element long vector.
c	The first call gives a double uniform in 0 .. 1.
c	The second gives an long integer uniform in 0 .. 2**31-1
c	Both update iseed[] in exactly the same way.
c	iseed[] must be a 2-element integer vector.
c	The initial value of the second element may be anything.
c
c	The period of the random sequence is 2**32 * (2**32-1)
c	The table mt[0:127] is defined by mt[i] = 69069 ** (128-i)
	*/

#define MASK ((long) 593970775)
/*	or in hex, 23674657	*/
#define SCALE ((double) 1.0 / (1024.0 * 1024.0 * 1024.0 * 2.0))
/*	i.e. 2 to power -31	*/

static long mt [128] =   {
      902906369,
     2030498053,
// Hier kommen noch 126 zahlen hab ich nicht alle gepostet !!
		};

double random (is)
	long is [2];
{
	long it, leh, nit;

	it = is[0];
	leh = is[1];
	if (it &lt;= 0)	
		it = (it + it) ^ MASK;
	else
		it = it + it;
	nit = it - 1;
/*	to ensure all-ones pattern omitted    */
	leh = leh * mt[nit &amp; 127] + nit;
	is [0] = it;    is [1] = leh;
	if (leh &lt; 0) leh = ~leh;
	return (SCALE * ((long) (leh | 1)));
}

long irandm (is)
	long is [2];
{
	long it, leh, nit;

	it = is [0];
	leh = is [1];
	if (it &lt;= 0)	
		it = (it + it) ^ MASK;
	else
		it = it + it;
	nit = it - 1;
/*	to ensure all-ones pattern omitted    */
	leh = leh * mt[nit &amp; 127] + nit;
	is [0] = it;    is [1] = leh;
	if (leh &lt; 0) leh = ~leh;
	return (leh);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/880487</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/880487</guid><dc:creator><![CDATA[NoobCoder]]></dc:creator><pubDate>Mon, 26 Sep 2005 14:23:06 GMT</pubDate></item><item><title><![CDATA[Reply to c und C++ mischen (compiler fehler) on Mon, 26 Sep 2005 15:16:21 GMT]]></title><description><![CDATA[<p>NoobCoder schrieb:</p>
<blockquote>
<pre><code class="language-cpp">/*
c	A random number generator called as a function by
c	random (iseed)	or	irandm (iseed)
c	The parameter should be a pointer to a 2-element long vector.
c	The first call gives a double uniform in 0 .. 1.
c	The second gives an long integer uniform in 0 .. 2**31-1
c	Both update iseed[] in exactly the same way.
c	iseed[] must be a 2-element integer vector.
c	The initial value of the second element may be anything.
c
c	The period of the random sequence is 2**32 * (2**32-1)
c	The table mt[0:127] is defined by mt[i] = 69069 ** (128-i)
	*/

#define MASK ((long) 593970775)
/*	or in hex, 23674657	*/
#define SCALE ((double) 1.0 / (1024.0 * 1024.0 * 1024.0 * 2.0))
/*	i.e. 2 to power -31	*/

static long mt [128] =   {
      902906369,
     2030498053,
// Hier kommen noch 126 zahlen hab ich nicht alle gepostet !!
		};

double random (long is [2])
{
	long it, leh, nit;

	it = is[0];
	leh = is[1];
	if (it &lt;= 0)	
		it = (it + it) ^ MASK;
	else
		it = it + it;
	nit = it - 1;
/*	to ensure all-ones pattern omitted    */
	leh = leh * mt[nit &amp; 127] + nit;
	is [0] = it;    is [1] = leh;
	if (leh &lt; 0) leh = ~leh;
	return (SCALE * ((long) (leh | 1)));
}

long irandm (long is [2])
{
	long it, leh, nit;

	it = is [0];
	leh = is [1];
	if (it &lt;= 0)	
		it = (it + it) ^ MASK;
	else
		it = it + it;
	nit = it - 1;
/*	to ensure all-ones pattern omitted    */
	leh = leh * mt[nit &amp; 127] + nit;
	is [0] = it;    is [1] = leh;
	if (leh &lt; 0) leh = ~leh;
	return (leh);
}
</code></pre>
</blockquote>
<p>Das sollte es wohl tun. Die Funktionsheader waren im Kernighan-Ritchie Style gehalten, der in C noch gültig war, in C++ aber anscheinend nicht mehr.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/880541</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/880541</guid><dc:creator><![CDATA[7H3 N4C3R]]></dc:creator><pubDate>Mon, 26 Sep 2005 15:16:21 GMT</pubDate></item><item><title><![CDATA[Reply to c und C++ mischen (compiler fehler) on Mon, 26 Sep 2005 15:56:42 GMT]]></title><description><![CDATA[<p>Vielen Dank das wars<br />
jetzt funktionierts auch in c++ <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>Stimmt der code war schon etwas älter (archiv)</p>
<p>*woher soll man sowas etwas wissen, in neuen Büchern kann man das nicht mehr lernen*</p>
<p>Trotzdem<br />
Danke noch mal</p>
]]></description><link>https://www.c-plusplus.net/forum/post/880602</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/880602</guid><dc:creator><![CDATA[NoobCoder]]></dc:creator><pubDate>Mon, 26 Sep 2005 15:56:42 GMT</pubDate></item><item><title><![CDATA[Reply to c und C++ mischen (compiler fehler) on Mon, 26 Sep 2005 16:02:26 GMT]]></title><description><![CDATA[<p>Bin auch nur durch Zufall vor kurzem drauf gestoßen <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="😉"
    /></p>
<p>Gruß.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/880613</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/880613</guid><dc:creator><![CDATA[7H3 N4C3R]]></dc:creator><pubDate>Mon, 26 Sep 2005 16:02:26 GMT</pubDate></item></channel></rss>