<?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[undefined reference to - Problem]]></title><description><![CDATA[<p>Hi,</p>
<p>wie aus dem Titel schon hervorgeht, habe ich ein Problem beim Compilieren mit irgendwelchen Referenzen, welches ich nicht alleine schaffe zu lösen.</p>
<p>Main.cpp</p>
<pre><code class="language-cpp">#include &quot;Deque.h&quot;

int main(void)
{  
    Deque&lt;int&gt;deq(100);
    return 0;   

}
</code></pre>
<p>Deque.h (nur wichtige Sachen)</p>
<pre><code class="language-cpp">#ifndef _DEQUE_H_

#define _DEQUE_H_

template &lt;class T&gt; class Deque 
{

 public:

	Deque(const int c = 2);

	~Deque(void);

private:

	T* myDeque;

};
</code></pre>
<p>Deque.cpp (nur wichtige Sachen)</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

#include &quot;Deque.h&quot;

    //Ctor

	template &lt;class T&gt; Deque&lt;T&gt;::Deque(const int c)
	{ 

         myDeque = new T[capacity = c];

	}

//Dtor

	template &lt;class T&gt; Deque&lt;T&gt;::~Deque(void)
	{

	     //Speicher freigeben

	     delete []myDeque;    

	}
</code></pre>
<p>Der Fehler:</p>
<blockquote>
<p>xyz@debian-server:~/Desktop/alg$ gcc -o Main Main.cpp Deque.cpp<br />
/tmp/ccuiYAbK.o: In function `main':Main.cpp:(.text+0x2c): undefined reference to `Deque&lt;int&gt;::Deque(int)'<br />
:Main.cpp:(.text+0x3c): undefined reference to <code>Deque&lt;int&gt;::~Deque()' /tmp/ccuiYAbK.o:(.eh\_frame+0x11): undefined reference to</code>__gxx_personality_v0'<br />
/tmp/ccKgtN6b.o: In function <code>\_\_tcf\_0':Deque.cpp:(.text+0xe): undefined reference to</code>std::ios_base::Init::~Init()'<br />
/tmp/ccKgtN6b.o: In function <code>\_\_static\_initialization\_and\_destruction\_0(int, int)':Deque.cpp:(.text+0x37): undefined reference to</code>std::ios_base::Init::Init()'<br />
/tmp/ccKgtN6b.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'<br />
collect2: ld gab 1 als Ende-Status zurück<br />
xyz@debian-server:~/Desktop/alg$</p>
</blockquote>
<p>Was muss ich noch machen, damit mein Main funktioniert? Es gibt kein weiteres Main innerhalb der Deque etc. Füge ich aber in die Deque ein main ein, kann ich die Deque von dort wunderbar nutzen. Ich verstehe jetzt nur nicht, wieso meine Deque aus dem Main nicht bekannt ist.</p>
<p>Danke!</p>
<p>VG</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/196453/undefined-reference-to-problem</link><generator>RSS for Node</generator><lastBuildDate>Wed, 30 Sep 2026 11:35:57 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/196453.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 29 Oct 2007 22:02:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to undefined reference to - Problem on Mon, 29 Oct 2007 22:02:03 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>wie aus dem Titel schon hervorgeht, habe ich ein Problem beim Compilieren mit irgendwelchen Referenzen, welches ich nicht alleine schaffe zu lösen.</p>
<p>Main.cpp</p>
<pre><code class="language-cpp">#include &quot;Deque.h&quot;

int main(void)
{  
    Deque&lt;int&gt;deq(100);
    return 0;   

}
</code></pre>
<p>Deque.h (nur wichtige Sachen)</p>
<pre><code class="language-cpp">#ifndef _DEQUE_H_

#define _DEQUE_H_

template &lt;class T&gt; class Deque 
{

 public:

	Deque(const int c = 2);

	~Deque(void);

private:

	T* myDeque;

};
</code></pre>
<p>Deque.cpp (nur wichtige Sachen)</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

#include &quot;Deque.h&quot;

    //Ctor

	template &lt;class T&gt; Deque&lt;T&gt;::Deque(const int c)
	{ 

         myDeque = new T[capacity = c];

	}

//Dtor

	template &lt;class T&gt; Deque&lt;T&gt;::~Deque(void)
	{

	     //Speicher freigeben

	     delete []myDeque;    

	}
</code></pre>
<p>Der Fehler:</p>
<blockquote>
<p>xyz@debian-server:~/Desktop/alg$ gcc -o Main Main.cpp Deque.cpp<br />
/tmp/ccuiYAbK.o: In function `main':Main.cpp:(.text+0x2c): undefined reference to `Deque&lt;int&gt;::Deque(int)'<br />
:Main.cpp:(.text+0x3c): undefined reference to <code>Deque&lt;int&gt;::~Deque()' /tmp/ccuiYAbK.o:(.eh\_frame+0x11): undefined reference to</code>__gxx_personality_v0'<br />
/tmp/ccKgtN6b.o: In function <code>\_\_tcf\_0':Deque.cpp:(.text+0xe): undefined reference to</code>std::ios_base::Init::~Init()'<br />
/tmp/ccKgtN6b.o: In function <code>\_\_static\_initialization\_and\_destruction\_0(int, int)':Deque.cpp:(.text+0x37): undefined reference to</code>std::ios_base::Init::Init()'<br />
/tmp/ccKgtN6b.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'<br />
collect2: ld gab 1 als Ende-Status zurück<br />
xyz@debian-server:~/Desktop/alg$</p>
</blockquote>
<p>Was muss ich noch machen, damit mein Main funktioniert? Es gibt kein weiteres Main innerhalb der Deque etc. Füge ich aber in die Deque ein main ein, kann ich die Deque von dort wunderbar nutzen. Ich verstehe jetzt nur nicht, wieso meine Deque aus dem Main nicht bekannt ist.</p>
<p>Danke!</p>
<p>VG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1394385</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1394385</guid><dc:creator><![CDATA[Eisscholle]]></dc:creator><pubDate>Mon, 29 Oct 2007 22:02:03 GMT</pubDate></item><item><title><![CDATA[Reply to undefined reference to - Problem on Mon, 29 Oct 2007 22:03:06 GMT]]></title><description><![CDATA[<p>Templateimplementierungen müssen in die Headerdateien.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1394386</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1394386</guid><dc:creator><![CDATA[Checker*amp*Murckser]]></dc:creator><pubDate>Mon, 29 Oct 2007 22:03:06 GMT</pubDate></item><item><title><![CDATA[Reply to undefined reference to - Problem on Mon, 29 Oct 2007 22:07:23 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>danke. Ich versuche mal mein Glück.</p>
<p>VG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1394389</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1394389</guid><dc:creator><![CDATA[Eisscholle]]></dc:creator><pubDate>Mon, 29 Oct 2007 22:07:23 GMT</pubDate></item></channel></rss>