<?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[Problem bei Deklaration einer static (Template-)Methode [gelöst]]]></title><description><![CDATA[<p>Hi,</p>
<p>ich möchte eine statische Methode implementieren.<br />
So gehts:</p>
<pre><code class="language-cpp">class C
{
public: 
 C(void);
 ~C(void);

 template&lt;typename T&gt;
 static void cleanup(CList&lt;T, T&gt;* pList)
 {
   foo(pList);
 }
};
</code></pre>
<p>Wenn ich aber die Methodendefinition in die cpp-Datei verschiebe (wie üblich), dann bekomme ich einen Linkererror:</p>
<p>error LNK2019: Verweis auf nicht aufgelöstes externes Symbol &quot;&quot;public: static void __cdecl C::cleanup(...</p>
<p>Sprich, so gehts irgendwie nicht:</p>
<pre><code class="language-cpp">C.h:

class C
{
public: 
 C(void);
 ~C(void);

 template&lt;typename T&gt;
 static void cleanup(CList&lt;T, T&gt;* pList);
};

----------------
C.cpp:

#include &quot;C.h&quot;
template&lt;typename T&gt;
static void C::cleanup(CList&lt;T, T&gt;* pList)
{
  foo(pList);
}
</code></pre>
<p>Jemand ne Idee, warum das so ist?<br />
Gruß, Thomas</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/182983/problem-bei-deklaration-einer-static-template-methode-gelöst</link><generator>RSS for Node</generator><lastBuildDate>Wed, 23 Sep 2026 01:58:13 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/182983.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 31 May 2007 10:42:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem bei Deklaration einer static (Template-)Methode [gelöst] on Thu, 31 May 2007 11:16:37 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich möchte eine statische Methode implementieren.<br />
So gehts:</p>
<pre><code class="language-cpp">class C
{
public: 
 C(void);
 ~C(void);

 template&lt;typename T&gt;
 static void cleanup(CList&lt;T, T&gt;* pList)
 {
   foo(pList);
 }
};
</code></pre>
<p>Wenn ich aber die Methodendefinition in die cpp-Datei verschiebe (wie üblich), dann bekomme ich einen Linkererror:</p>
<p>error LNK2019: Verweis auf nicht aufgelöstes externes Symbol &quot;&quot;public: static void __cdecl C::cleanup(...</p>
<p>Sprich, so gehts irgendwie nicht:</p>
<pre><code class="language-cpp">C.h:

class C
{
public: 
 C(void);
 ~C(void);

 template&lt;typename T&gt;
 static void cleanup(CList&lt;T, T&gt;* pList);
};

----------------
C.cpp:

#include &quot;C.h&quot;
template&lt;typename T&gt;
static void C::cleanup(CList&lt;T, T&gt;* pList)
{
  foo(pList);
}
</code></pre>
<p>Jemand ne Idee, warum das so ist?<br />
Gruß, Thomas</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1295811</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1295811</guid><dc:creator><![CDATA[Thomas++]]></dc:creator><pubDate>Thu, 31 May 2007 11:16:37 GMT</pubDate></item><item><title><![CDATA[Reply to Problem bei Deklaration einer static (Template-)Methode [gelöst] on Thu, 31 May 2007 10:47:17 GMT]]></title><description><![CDATA[<p>Die Funktionsdefinition muss mit in die Headerdatei. Bei Templates müssen Deklaration und Definition in einer Datei stehen. Wurde schon sehr oft hier gesagt.</p>
<p>Greetz</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1295812</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1295812</guid><dc:creator><![CDATA[Vellas]]></dc:creator><pubDate>Thu, 31 May 2007 10:47:17 GMT</pubDate></item><item><title><![CDATA[Reply to Problem bei Deklaration einer static (Template-)Methode [gelöst] on Thu, 31 May 2007 11:16:14 GMT]]></title><description><![CDATA[<p>Stimmt, sorry - sehe ich gerade.<br />
Danke für den Tipp.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1295828</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1295828</guid><dc:creator><![CDATA[Thomas++]]></dc:creator><pubDate>Thu, 31 May 2007 11:16:14 GMT</pubDate></item></channel></rss>