<?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[Verweis auf nicht aufgelöstes externes Symbol]]></title><description><![CDATA[<p>Halloo.</p>
<p>Ich hab beim Compilieren ein paar Fehlermeldungen, wo ich nicht weiß, was ich damit anfangen soll.</p>
<blockquote>
<p>Fehler 4 error LNK2019: Verweis auf nicht aufgelöstes externes Symbol &quot;&quot;public: __thiscall Stack&lt;class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; &gt;::Stack&lt;class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; &gt;(void)&quot; (??0?<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>S</mi><mi>t</mi><mi>a</mi><mi>c</mi><mi>k</mi><mi mathvariant="normal">@</mi><mi>V</mi><mo>?</mo></mrow><annotation encoding="application/x-tex">Stack@V?</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.69444em;"></span><span class="strut bottom" style="height:0.69444em;vertical-align:0em;"></span><span class="base textstyle uncramped"><span class="mord mathit" style="margin-right:0.05764em;">S</span><span class="mord mathit">t</span><span class="mord mathit">a</span><span class="mord mathit">c</span><span class="mord mathit" style="margin-right:0.03148em;">k</span><span class="mord mathrm">@</span><span class="mord mathit" style="margin-right:0.22222em;">V</span><span class="mclose">?</span></span></span></span>basic_string@DU?<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>c</mi><mi>h</mi><mi>a</mi><mi>r</mi><mi mathvariant="normal">_</mi><mi>t</mi><mi>r</mi><mi>a</mi><mi>i</mi><mi>t</mi><mi>s</mi><mi mathvariant="normal">@</mi><mi>D</mi><mi mathvariant="normal">@</mi><mi>s</mi><mi>t</mi><mi>d</mi><mi mathvariant="normal">@</mi><mi mathvariant="normal">@</mi><mi>V</mi><mo>?</mo></mrow><annotation encoding="application/x-tex">char\_traits@D@std@@V?</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.69444em;"></span><span class="strut bottom" style="height:1.00444em;vertical-align:-0.31em;"></span><span class="base textstyle uncramped"><span class="mord mathit">c</span><span class="mord mathit">h</span><span class="mord mathit">a</span><span class="mord mathit" style="margin-right:0.02778em;">r</span><span class="mord mathrm" style="margin-right:0.02778em;">_</span><span class="mord mathit">t</span><span class="mord mathit" style="margin-right:0.02778em;">r</span><span class="mord mathit">a</span><span class="mord mathit">i</span><span class="mord mathit">t</span><span class="mord mathit">s</span><span class="mord mathrm">@</span><span class="mord mathit" style="margin-right:0.02778em;">D</span><span class="mord mathrm">@</span><span class="mord mathit">s</span><span class="mord mathit">t</span><span class="mord mathit">d</span><span class="mord mathrm">@</span><span class="mord mathrm">@</span><span class="mord mathit" style="margin-right:0.22222em;">V</span><span class="mclose">?</span></span></span></span>allocator@D@2@@std@@@@QAE@XZ)&quot; in Funktion &quot;_main&quot;.</p>
</blockquote>
<p>Die anderen sind auch so ähnlich.</p>
<p>Hier mein Quellcode:</p>
<pre><code>//main

#include &quot;stack.h&quot;
#include &lt;string&gt;

using namespace std;

int main() {
	try {
		Stack&lt;string&gt; s;

		string a = &quot;A&quot;;
		string b = &quot;B&quot;;
		string c = &quot;C&quot;;
		string d = &quot;D&quot;;
		string e = &quot;E&quot;;

		s.push(a);
		s.push(b);
		s.push(c);
		s.push(d);
		s.push(e);

		for (int i = 0; i &lt; 6; i++)
		{

			cout &lt;&lt; s.pop() &lt;&lt; endl;

		}

	}
	catch (exception const&amp; ex) 
	{
		cerr &lt;&lt; &quot;Exceptoin: &quot; &lt;&lt; ex.what() &lt;&lt; endl;
	}

	system(&quot;pause&quot;);
	return 0;
}
</code></pre>
<pre><code>#include &quot;stack.h&quot;

//Konstruktor
template &lt;class T&gt;
Stack&lt;T&gt;::Stack() 
{
	numElems = 0;
	size = 5;
	elems = new T [size];
}

//Destruktor
template &lt;class T&gt;
Stack&lt;T&gt;::~Stack() 
{
	delete [] elems;
}

//push
template &lt;class T&gt;
void Stack&lt;T&gt;::push (T&amp; x) 
{
	if (size &lt;=numElems)
	{
		T* tmp = elems;
		size *= 2;
		elems = new T [size]

		for (int i = 0; i &lt; numElems; i++)
		{
			elems[i] = tmp[i];
		}

		delete [] tmp;
	}

	elems[numElems++] = x;
}

//pop
template &lt;class T&gt;
T Stack&lt;T&gt;::pop()
{
	if (numElems == 0)
	{
		cerr &lt;&lt; &quot;Stack leer!&quot; &lt;&lt; endl;
		exit (1);
	}

	return elems[--numElems];
}

//isEmpty
template &lt;class T&gt;
bool Stack&lt;T&gt;::isEmpty() const
{
	if ( elems == NULL)
	{
		return true;
	}
	return false;
}

//isFull
template &lt;class T&gt;
bool Stack&lt;T&gt;::isFull() const 
{
	if (numElems &lt; size) 
	{
		return true;
	}
	else 
	{
		return false;
	}
}
</code></pre>
<pre><code>#ifndef stack_h
#define stack_h
#include &lt;iostream&gt;
#include &lt;exception&gt;

using namespace std;

template &lt;class T&gt;

class Stack {

public:
	Stack();
	~Stack();
	void push(T &amp;);
	T pop();
	bool isEmpty() const;
	bool isFull() const;

private:
	int size, numElems;
	T *elems;

};

#endif
</code></pre>
<p>Nach 2 Stunden Fehlersuche, weiß ich nicht, wo ich weiter machen soll.<br />
Vielleicht hat jemand einen Rat?!<br />
Danke <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>
]]></description><link>https://www.c-plusplus.net/forum/topic/305291/verweis-auf-nicht-aufgelöstes-externes-symbol</link><generator>RSS for Node</generator><lastBuildDate>Sun, 09 Aug 2026 01:15:10 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/305291.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 25 Jun 2012 17:02:50 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Verweis auf nicht aufgelöstes externes Symbol on Mon, 25 Jun 2012 17:02:50 GMT]]></title><description><![CDATA[<p>Halloo.</p>
<p>Ich hab beim Compilieren ein paar Fehlermeldungen, wo ich nicht weiß, was ich damit anfangen soll.</p>
<blockquote>
<p>Fehler 4 error LNK2019: Verweis auf nicht aufgelöstes externes Symbol &quot;&quot;public: __thiscall Stack&lt;class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; &gt;::Stack&lt;class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; &gt;(void)&quot; (??0?<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>S</mi><mi>t</mi><mi>a</mi><mi>c</mi><mi>k</mi><mi mathvariant="normal">@</mi><mi>V</mi><mo>?</mo></mrow><annotation encoding="application/x-tex">Stack@V?</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.69444em;"></span><span class="strut bottom" style="height:0.69444em;vertical-align:0em;"></span><span class="base textstyle uncramped"><span class="mord mathit" style="margin-right:0.05764em;">S</span><span class="mord mathit">t</span><span class="mord mathit">a</span><span class="mord mathit">c</span><span class="mord mathit" style="margin-right:0.03148em;">k</span><span class="mord mathrm">@</span><span class="mord mathit" style="margin-right:0.22222em;">V</span><span class="mclose">?</span></span></span></span>basic_string@DU?<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>c</mi><mi>h</mi><mi>a</mi><mi>r</mi><mi mathvariant="normal">_</mi><mi>t</mi><mi>r</mi><mi>a</mi><mi>i</mi><mi>t</mi><mi>s</mi><mi mathvariant="normal">@</mi><mi>D</mi><mi mathvariant="normal">@</mi><mi>s</mi><mi>t</mi><mi>d</mi><mi mathvariant="normal">@</mi><mi mathvariant="normal">@</mi><mi>V</mi><mo>?</mo></mrow><annotation encoding="application/x-tex">char\_traits@D@std@@V?</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.69444em;"></span><span class="strut bottom" style="height:1.00444em;vertical-align:-0.31em;"></span><span class="base textstyle uncramped"><span class="mord mathit">c</span><span class="mord mathit">h</span><span class="mord mathit">a</span><span class="mord mathit" style="margin-right:0.02778em;">r</span><span class="mord mathrm" style="margin-right:0.02778em;">_</span><span class="mord mathit">t</span><span class="mord mathit" style="margin-right:0.02778em;">r</span><span class="mord mathit">a</span><span class="mord mathit">i</span><span class="mord mathit">t</span><span class="mord mathit">s</span><span class="mord mathrm">@</span><span class="mord mathit" style="margin-right:0.02778em;">D</span><span class="mord mathrm">@</span><span class="mord mathit">s</span><span class="mord mathit">t</span><span class="mord mathit">d</span><span class="mord mathrm">@</span><span class="mord mathrm">@</span><span class="mord mathit" style="margin-right:0.22222em;">V</span><span class="mclose">?</span></span></span></span>allocator@D@2@@std@@@@QAE@XZ)&quot; in Funktion &quot;_main&quot;.</p>
</blockquote>
<p>Die anderen sind auch so ähnlich.</p>
<p>Hier mein Quellcode:</p>
<pre><code>//main

#include &quot;stack.h&quot;
#include &lt;string&gt;

using namespace std;

int main() {
	try {
		Stack&lt;string&gt; s;

		string a = &quot;A&quot;;
		string b = &quot;B&quot;;
		string c = &quot;C&quot;;
		string d = &quot;D&quot;;
		string e = &quot;E&quot;;

		s.push(a);
		s.push(b);
		s.push(c);
		s.push(d);
		s.push(e);

		for (int i = 0; i &lt; 6; i++)
		{

			cout &lt;&lt; s.pop() &lt;&lt; endl;

		}

	}
	catch (exception const&amp; ex) 
	{
		cerr &lt;&lt; &quot;Exceptoin: &quot; &lt;&lt; ex.what() &lt;&lt; endl;
	}

	system(&quot;pause&quot;);
	return 0;
}
</code></pre>
<pre><code>#include &quot;stack.h&quot;

//Konstruktor
template &lt;class T&gt;
Stack&lt;T&gt;::Stack() 
{
	numElems = 0;
	size = 5;
	elems = new T [size];
}

//Destruktor
template &lt;class T&gt;
Stack&lt;T&gt;::~Stack() 
{
	delete [] elems;
}

//push
template &lt;class T&gt;
void Stack&lt;T&gt;::push (T&amp; x) 
{
	if (size &lt;=numElems)
	{
		T* tmp = elems;
		size *= 2;
		elems = new T [size]

		for (int i = 0; i &lt; numElems; i++)
		{
			elems[i] = tmp[i];
		}

		delete [] tmp;
	}

	elems[numElems++] = x;
}

//pop
template &lt;class T&gt;
T Stack&lt;T&gt;::pop()
{
	if (numElems == 0)
	{
		cerr &lt;&lt; &quot;Stack leer!&quot; &lt;&lt; endl;
		exit (1);
	}

	return elems[--numElems];
}

//isEmpty
template &lt;class T&gt;
bool Stack&lt;T&gt;::isEmpty() const
{
	if ( elems == NULL)
	{
		return true;
	}
	return false;
}

//isFull
template &lt;class T&gt;
bool Stack&lt;T&gt;::isFull() const 
{
	if (numElems &lt; size) 
	{
		return true;
	}
	else 
	{
		return false;
	}
}
</code></pre>
<pre><code>#ifndef stack_h
#define stack_h
#include &lt;iostream&gt;
#include &lt;exception&gt;

using namespace std;

template &lt;class T&gt;

class Stack {

public:
	Stack();
	~Stack();
	void push(T &amp;);
	T pop();
	bool isEmpty() const;
	bool isFull() const;

private:
	int size, numElems;
	T *elems;

};

#endif
</code></pre>
<p>Nach 2 Stunden Fehlersuche, weiß ich nicht, wo ich weiter machen soll.<br />
Vielleicht hat jemand einen Rat?!<br />
Danke <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>
]]></description><link>https://www.c-plusplus.net/forum/post/2227097</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2227097</guid><dc:creator><![CDATA[KeinNameMehrFrei]]></dc:creator><pubDate>Mon, 25 Jun 2012 17:02:50 GMT</pubDate></item><item><title><![CDATA[Reply to Verweis auf nicht aufgelöstes externes Symbol on Mon, 25 Jun 2012 17:05:53 GMT]]></title><description><![CDATA[<p><a href="http://www.c-plusplus.net/forum/151578" rel="nofollow">http://www.c-plusplus.net/forum/151578</a></p>
<ol start="5">
<li></li>
</ol>
<p>edit: Da ich den nächsten Fehler schon voraus sehe:<br />
<a href="https://www.google.de/search?&amp;q=C%2B%2B%20Regel%20der%20gro%C3%9Fen%20Drei" rel="nofollow">Google: C++ Regel der großen Drei</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2227098</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2227098</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 25 Jun 2012 17:05:53 GMT</pubDate></item><item><title><![CDATA[Reply to Verweis auf nicht aufgelöstes externes Symbol on Mon, 25 Jun 2012 17:23:02 GMT]]></title><description><![CDATA[<p>Danke, 5. hat geholfen.</p>
<p>Allerdings muss ich da nochmal nachfragen.<br />
Ich hatte mir ein Skript zur Hilfe genommen, wo die Template-Klassen im Header deklariert wurden, aber in einer cpp Datei implementiert wurden.</p>
<p>Muss ich immer alles in den Header packen, oder funktioniert das auch &quot;extern&quot; in einer cpp?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2227101</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2227101</guid><dc:creator><![CDATA[KeinNameMehrFrei]]></dc:creator><pubDate>Mon, 25 Jun 2012 17:23:02 GMT</pubDate></item><item><title><![CDATA[Reply to Verweis auf nicht aufgelöstes externes Symbol on Mon, 25 Jun 2012 17:28:20 GMT]]></title><description><![CDATA[<p>Es gibt einen einzigen exotischen Compiler, der externe Templatedefinitionen kennt. Wenn dein Script das anders macht, dann hast entweder du etwas an der Stelle falsch verstanden oder das Script ist vollkommen weltfremd. Eine halbwegs gängige Methode ist noch, die Templatedefinitionen in der Headerdatei per include einzubinden. Also ausnahmsweise mal eine Sorucedatei bei include anzugeben. In der Datei dürfen dann aber keine anderen Definitionen (mit externer Linkage) stehen!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2227102</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2227102</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 25 Jun 2012 17:28:20 GMT</pubDate></item><item><title><![CDATA[Reply to Verweis auf nicht aufgelöstes externes Symbol on Mon, 25 Jun 2012 17:42:18 GMT]]></title><description><![CDATA[<p>Ok, vielen Dank für die Erklärung <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>
]]></description><link>https://www.c-plusplus.net/forum/post/2227108</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2227108</guid><dc:creator><![CDATA[KeinNameMehrFrei]]></dc:creator><pubDate>Mon, 25 Jun 2012 17:42:18 GMT</pubDate></item></channel></rss>