<?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[lineare Liste mit Template]]></title><description><![CDATA[<p>Ich versuche eine dynamisch verwaltete Lineare Liste zu erstellen, die verschiedenste Datentypen verwalten kann.</p>
<p>Also LISTE&lt;int&gt;, LISTE&lt;char&gt;, etc.</p>
<p>in main.cpp:</p>
<pre><code class="language-cpp">#include &lt;cstdlib&gt;
#include &lt;iostream&gt;

#include &quot;knoten.h&quot;
#include &quot;liste.h&quot;

using namespace std;

int main(int argc, char *argv[])
{
    Liste&lt;int&gt; intListe;
    Liste&lt;char&gt; charListe;
    Liste&lt;double&gt; doubleListe;

    Knoten&lt;int&gt; intKnoten;
    // etc.

    system(&quot;pause&quot;);     

    return EXIT_SUCCESS;
}
</code></pre>
<p>in liste.h:</p>
<pre><code class="language-cpp">#ifndef LISTE_H
#define LISTE_H

using namespace std;

template &lt;class T&gt; class Liste
{
	public:
		// class constructor
		Liste();
		// class destructor
		~Liste();
};

// class constructor
template &lt;class T&gt; Liste&lt;T&gt;::Liste()
{
	// insert your code here
}

// class destructor
template &lt;class T&gt; Liste&lt;T&gt;::~Liste()
{
	// insert your code here
}

#endif // LISTE_H
</code></pre>
<p>in knoten.h:</p>
<pre><code class="language-cpp">#ifndef KNOTEN_H
#define KNOTEN_H

using namespace std;

template &lt;class T&gt; class Knoten
{
	public:
		// class constructor
		Knoten();
		// class destructor
		~Knoten();
};

// class constructor
template &lt;class T&gt; Knoten&lt;T&gt;::Knoten()
{
	// insert your code here
}

// class destructor
template &lt;class T&gt; Knoten&lt;T&gt;::~Knoten()
{
	// insert your code here
}

#endif // KNOTEN_H
</code></pre>
<p>Ich habe zwar soweit noch nichts implementiert, bekomme aber so schon Linker-Fehler bei DevC++:</p>
<blockquote>
<p>[Linker error] undefined reference to `__cpu_features_init'<br />
ld returned 1 exit status<br />
C:\Dokumente und Einstellungen\Makefile.win [Build Error] [TemplateListe.exe] Error 1</p>
</blockquote>
<p>bzw. die folgenden Fehler beim Gnu-Compiler:</p>
<blockquote>
<p>C:\Dokumente und Einstellungen&gt;gcc -o liste.exe main.cpp knoten.h liste.h<br />
knoten.h:6: error: syntax error before &quot;namespace&quot;<br />
knoten.h:6: warning: data definition has no type or storage class<br />
knoten.h:8: error: syntax error before '&lt;' token<br />
knoten.h:18: error: syntax error before '&lt;' token<br />
liste.h:6: error: syntax error before &quot;namespace&quot;<br />
liste.h:6: warning: data definition has no type or storage class<br />
liste.h:8: error: syntax error before '&lt;' token<br />
liste.h:18: error: syntax error before '&lt;' token</p>
</blockquote>
<p>Leider weiß ich nicht wo der Fehler liegt... könnt ihr mir helfen?</p>
<p>Gruß, sunnymay!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/189122/lineare-liste-mit-template</link><generator>RSS for Node</generator><lastBuildDate>Fri, 25 Sep 2026 06:56:22 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/189122.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 08 Aug 2007 16:36:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to lineare Liste mit Template on Wed, 08 Aug 2007 16:36:26 GMT]]></title><description><![CDATA[<p>Ich versuche eine dynamisch verwaltete Lineare Liste zu erstellen, die verschiedenste Datentypen verwalten kann.</p>
<p>Also LISTE&lt;int&gt;, LISTE&lt;char&gt;, etc.</p>
<p>in main.cpp:</p>
<pre><code class="language-cpp">#include &lt;cstdlib&gt;
#include &lt;iostream&gt;

#include &quot;knoten.h&quot;
#include &quot;liste.h&quot;

using namespace std;

int main(int argc, char *argv[])
{
    Liste&lt;int&gt; intListe;
    Liste&lt;char&gt; charListe;
    Liste&lt;double&gt; doubleListe;

    Knoten&lt;int&gt; intKnoten;
    // etc.

    system(&quot;pause&quot;);     

    return EXIT_SUCCESS;
}
</code></pre>
<p>in liste.h:</p>
<pre><code class="language-cpp">#ifndef LISTE_H
#define LISTE_H

using namespace std;

template &lt;class T&gt; class Liste
{
	public:
		// class constructor
		Liste();
		// class destructor
		~Liste();
};

// class constructor
template &lt;class T&gt; Liste&lt;T&gt;::Liste()
{
	// insert your code here
}

// class destructor
template &lt;class T&gt; Liste&lt;T&gt;::~Liste()
{
	// insert your code here
}

#endif // LISTE_H
</code></pre>
<p>in knoten.h:</p>
<pre><code class="language-cpp">#ifndef KNOTEN_H
#define KNOTEN_H

using namespace std;

template &lt;class T&gt; class Knoten
{
	public:
		// class constructor
		Knoten();
		// class destructor
		~Knoten();
};

// class constructor
template &lt;class T&gt; Knoten&lt;T&gt;::Knoten()
{
	// insert your code here
}

// class destructor
template &lt;class T&gt; Knoten&lt;T&gt;::~Knoten()
{
	// insert your code here
}

#endif // KNOTEN_H
</code></pre>
<p>Ich habe zwar soweit noch nichts implementiert, bekomme aber so schon Linker-Fehler bei DevC++:</p>
<blockquote>
<p>[Linker error] undefined reference to `__cpu_features_init'<br />
ld returned 1 exit status<br />
C:\Dokumente und Einstellungen\Makefile.win [Build Error] [TemplateListe.exe] Error 1</p>
</blockquote>
<p>bzw. die folgenden Fehler beim Gnu-Compiler:</p>
<blockquote>
<p>C:\Dokumente und Einstellungen&gt;gcc -o liste.exe main.cpp knoten.h liste.h<br />
knoten.h:6: error: syntax error before &quot;namespace&quot;<br />
knoten.h:6: warning: data definition has no type or storage class<br />
knoten.h:8: error: syntax error before '&lt;' token<br />
knoten.h:18: error: syntax error before '&lt;' token<br />
liste.h:6: error: syntax error before &quot;namespace&quot;<br />
liste.h:6: warning: data definition has no type or storage class<br />
liste.h:8: error: syntax error before '&lt;' token<br />
liste.h:18: error: syntax error before '&lt;' token</p>
</blockquote>
<p>Leider weiß ich nicht wo der Fehler liegt... könnt ihr mir helfen?</p>
<p>Gruß, sunnymay!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1340971</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1340971</guid><dc:creator><![CDATA[sunnymay]]></dc:creator><pubDate>Wed, 08 Aug 2007 16:36:26 GMT</pubDate></item><item><title><![CDATA[Reply to lineare Liste mit Template on Wed, 08 Aug 2007 16:53:55 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#if !defined(LISTE_H__INCLUDED)
#define LISTE_H__INCLUDED

template &lt;typename T&gt;class list
{
public:
    Liste() {}
    ~Liste() {}

protected:
    class node
    {
        node() {}
        ~node() {}
    } * m_begin;
};

#endif // LISTE_H__INCLUDED
</code></pre>
<p><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/1340987</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1340987</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Wed, 08 Aug 2007 16:53:55 GMT</pubDate></item><item><title><![CDATA[Reply to lineare Liste mit Template on Wed, 08 Aug 2007 18:00:15 GMT]]></title><description><![CDATA[<p>Das habe ich gerade ausprobiert, allerdings bekomme ich immer noch den gleichen Linker error <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":-("
      alt="😞"
    /></p>
<p>Woran könnte das denn liegen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1341011</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1341011</guid><dc:creator><![CDATA[sunnymay]]></dc:creator><pubDate>Wed, 08 Aug 2007 18:00:15 GMT</pubDate></item><item><title><![CDATA[Reply to lineare Liste mit Template on Wed, 08 Aug 2007 18:04:03 GMT]]></title><description><![CDATA[<p>So wie das da steht willst du nen Fehler bekommen?!<br />
<strong>main.cpp</strong></p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &quot;list.h&quot;

int main()
{
    list&lt;int&gt; list_int;
    list&lt;char&gt; list_char;
    list&lt;double&gt; list_double;

    std::cin.get();    
}
</code></pre>
<p><strong>list.h</strong></p>
<pre><code class="language-cpp">#if !defined(LISTE_H__INCLUDED)
#define LISTE_H__INCLUDED

template &lt;typename T&gt;class list
{
public:
    list() {}
    ~list() {}

protected:
    class node
    {
        node() {}
        ~node() {}
    } * m_begin;
};

#endif // LISTE_H__INCLUDED
</code></pre>
<p>das geht zu 10000% <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>Also nochmal versuchen <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/1341015</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1341015</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Wed, 08 Aug 2007 18:04:03 GMT</pubDate></item><item><title><![CDATA[Reply to lineare Liste mit Template on Wed, 08 Aug 2007 18:23:11 GMT]]></title><description><![CDATA[<p>Das ist ja gerade das Problem! Wenn ich simples copy&amp;paste mache und dann kompiliere bekomme ich das:</p>
<blockquote>
<p>In file included from main.cpp:2:<br />
list.h:4: error: syntax error before '&lt;' token<br />
list.h:15: warning: data definition has no type or storage class<br />
list.h:16: error: syntax error before '}' token</p>
</blockquote>
<p>mit DevC++ das gleiche.</p>
<p>Ich habe mittlerweile auch schon DevC++ deinstalliert und neu installiert, aber keine Änderung.</p>
<p>Ich habe gerade mal ältere Quellcodes getestet, bei denen Ähnliches passiert.<br />
DevC++ sagt:</p>
<blockquote>
<p>[Linker error] undefined reference to `__cpu_features_init'<br />
ld returned 1 exit status<br />
C:\Dokumente und Einstellungen\...\Makefile.win [Build Error] [Artikel.exe] Error 1</p>
</blockquote>
<p>Ich verzweifele gerade <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1341020</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1341020</guid><dc:creator><![CDATA[sunnymay]]></dc:creator><pubDate>Wed, 08 Aug 2007 18:23:11 GMT</pubDate></item><item><title><![CDATA[Reply to lineare Liste mit Template on Wed, 08 Aug 2007 18:50:12 GMT]]></title><description><![CDATA[<p>Möp... DevC++ runterschmeißen und Qualität aller MS (MS Visual C++ 2005 Express Edition) oder G++ drauf tun! Weiß nicht was du da für ne DevC++ Version hast aber scheint nicht mit Templates klar zu kommen ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1341034</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1341034</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Wed, 08 Aug 2007 18:50:12 GMT</pubDate></item><item><title><![CDATA[Reply to lineare Liste mit Template on Wed, 08 Aug 2007 18:53:47 GMT]]></title><description><![CDATA[<p>Tja, wer weiß woran es gelegen hat...</p>
<p>habe nochmal DevC++ deinstalliert, neu installiert und nun funktioniert deine Version doch!</p>
<p>Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1341037</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1341037</guid><dc:creator><![CDATA[sunnymay]]></dc:creator><pubDate>Wed, 08 Aug 2007 18:53:47 GMT</pubDate></item><item><title><![CDATA[Reply to lineare Liste mit Template on Wed, 08 Aug 2007 19:03:45 GMT]]></title><description><![CDATA[<p>sunnymay schrieb:</p>
<blockquote>
<blockquote>
<p>C:\Dokumente und Einstellungen&gt;gcc -o liste.exe main.cpp knoten.h liste.h<br />
knoten.h:6: error: syntax error before &quot;namespace&quot;<br />
knoten.h:6: warning: data definition has no type or storage class<br />
knoten.h:8: error: syntax error before '&lt;' token<br />
knoten.h:18: error: syntax error before '&lt;' token<br />
liste.h:6: error: syntax error before &quot;namespace&quot;<br />
liste.h:6: warning: data definition has no type or storage class<br />
liste.h:8: error: syntax error before '&lt;' token<br />
liste.h:18: error: syntax error before '&lt;' token</p>
</blockquote>
<p>Leider weiß ich nicht wo der Fehler liegt... könnt ihr mir helfen?</p>
<p>Gruß, sunnymay!</p>
</blockquote>
<p>Header sind nicht zum Separatkompilieren da. Der Compiler beschwert sich über das using namespace std (was ohnehin im Header auf Namespaceebene nichts verloren hat) ohne vorherige Deklaration des Bezeichners std.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1341042</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1341042</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Wed, 08 Aug 2007 19:03:45 GMT</pubDate></item><item><title><![CDATA[Reply to lineare Liste mit Template on Wed, 08 Aug 2007 22:40:32 GMT]]></title><description><![CDATA[<blockquote>
<p>C:\Dokumente und Einstellungen&gt;gcc -o liste.exe main.cpp knoten.h liste.h</p>
</blockquote>
<p>Nimm g++, um C++-Code zu kompilieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1341138</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1341138</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Wed, 08 Aug 2007 22:40:32 GMT</pubDate></item></channel></rss>