<?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[[gelöst] template linker Fehler]]></title><description><![CDATA[<p>Ich bekomme folgenden Fehler:</p>
<blockquote>
<p>1&gt;LaserData.obj : error LNK2001: unresolved external symbol &quot;int __cdecl ArrayCenterPos&lt;double&gt;(class std::vector&lt;double,class std::allocator&lt;double&gt; &gt; &amp;,double)&quot; (??<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>A</mi><mi>r</mi><mi>r</mi><mi>a</mi><mi>y</mi><mi>C</mi><mi>e</mi><mi>n</mi><mi>t</mi><mi>e</mi><mi>r</mi><mi>P</mi><mi>o</mi><mi>s</mi><mi mathvariant="normal">@</mi><mi>N</mi><mi mathvariant="normal">@</mi><mi mathvariant="normal">@</mi><mi>Y</mi><mi>A</mi><mi>H</mi><mi>A</mi><mi>A</mi><mi>V</mi><mo>?</mo></mrow><annotation encoding="application/x-tex">ArrayCenterPos@N@@YAHAAV?</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.8888799999999999em;vertical-align:-0.19444em;"></span><span class="base textstyle uncramped"><span class="mord mathit">A</span><span class="mord mathit" style="margin-right:0.02778em;">r</span><span class="mord mathit" style="margin-right:0.02778em;">r</span><span class="mord mathit">a</span><span class="mord mathit" style="margin-right:0.03588em;">y</span><span class="mord mathit" style="margin-right:0.07153em;">C</span><span class="mord mathit">e</span><span class="mord mathit">n</span><span class="mord mathit">t</span><span class="mord mathit">e</span><span class="mord mathit" style="margin-right:0.02778em;">r</span><span class="mord mathit" style="margin-right:0.13889em;">P</span><span class="mord mathit">o</span><span class="mord mathit">s</span><span class="mord mathrm">@</span><span class="mord mathit" style="margin-right:0.10903em;">N</span><span class="mord mathrm">@</span><span class="mord mathrm">@</span><span class="mord mathit" style="margin-right:0.22222em;">Y</span><span class="mord mathit">A</span><span class="mord mathit" style="margin-right:0.08125em;">H</span><span class="mord mathit">A</span><span class="mord mathit">A</span><span class="mord mathit" style="margin-right:0.22222em;">V</span><span class="mclose">?</span></span></span></span>vector@NV?$allocator@N@std@@@std@@N@Z)</p>
</blockquote>
<p>was zu der Funktion</p>
<pre><code class="language-cpp">template&lt;typename T&gt;	int ArrayCenterPos(vector&lt;T&gt; &amp; InArray, T threshold);
template&lt;typename T&gt;	int ArrayCenterPos(T * InArray, int size, T threshold);

template&lt;typename T&gt;
int ArrayCenterPos(vector&lt;T&gt; const &amp; InArray, T threshold)
{
	return ArrayCenterPos(&amp;InArray[0], (int)InArray.size(), threshold);
}

template&lt;typename T&gt;
int ArrayCenterPos(T * InArray, int size, T threshold)
{
...
}
</code></pre>
<p>gehört.</p>
<p>Die Funktionen sind in einer header Datei die in der h Datei einer Klasse geladen wird.</p>
<p>EDIT:<br />
Der Protoype und die Definition stimmen nicht überein (const)</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/241479/gelöst-template-linker-fehler</link><generator>RSS for Node</generator><lastBuildDate>Mon, 21 Sep 2026 12:28:36 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/241479.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 21 May 2009 07:56:32 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [gelöst] template linker Fehler on Thu, 21 May 2009 08:01:41 GMT]]></title><description><![CDATA[<p>Ich bekomme folgenden Fehler:</p>
<blockquote>
<p>1&gt;LaserData.obj : error LNK2001: unresolved external symbol &quot;int __cdecl ArrayCenterPos&lt;double&gt;(class std::vector&lt;double,class std::allocator&lt;double&gt; &gt; &amp;,double)&quot; (??<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>A</mi><mi>r</mi><mi>r</mi><mi>a</mi><mi>y</mi><mi>C</mi><mi>e</mi><mi>n</mi><mi>t</mi><mi>e</mi><mi>r</mi><mi>P</mi><mi>o</mi><mi>s</mi><mi mathvariant="normal">@</mi><mi>N</mi><mi mathvariant="normal">@</mi><mi mathvariant="normal">@</mi><mi>Y</mi><mi>A</mi><mi>H</mi><mi>A</mi><mi>A</mi><mi>V</mi><mo>?</mo></mrow><annotation encoding="application/x-tex">ArrayCenterPos@N@@YAHAAV?</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.8888799999999999em;vertical-align:-0.19444em;"></span><span class="base textstyle uncramped"><span class="mord mathit">A</span><span class="mord mathit" style="margin-right:0.02778em;">r</span><span class="mord mathit" style="margin-right:0.02778em;">r</span><span class="mord mathit">a</span><span class="mord mathit" style="margin-right:0.03588em;">y</span><span class="mord mathit" style="margin-right:0.07153em;">C</span><span class="mord mathit">e</span><span class="mord mathit">n</span><span class="mord mathit">t</span><span class="mord mathit">e</span><span class="mord mathit" style="margin-right:0.02778em;">r</span><span class="mord mathit" style="margin-right:0.13889em;">P</span><span class="mord mathit">o</span><span class="mord mathit">s</span><span class="mord mathrm">@</span><span class="mord mathit" style="margin-right:0.10903em;">N</span><span class="mord mathrm">@</span><span class="mord mathrm">@</span><span class="mord mathit" style="margin-right:0.22222em;">Y</span><span class="mord mathit">A</span><span class="mord mathit" style="margin-right:0.08125em;">H</span><span class="mord mathit">A</span><span class="mord mathit">A</span><span class="mord mathit" style="margin-right:0.22222em;">V</span><span class="mclose">?</span></span></span></span>vector@NV?$allocator@N@std@@@std@@N@Z)</p>
</blockquote>
<p>was zu der Funktion</p>
<pre><code class="language-cpp">template&lt;typename T&gt;	int ArrayCenterPos(vector&lt;T&gt; &amp; InArray, T threshold);
template&lt;typename T&gt;	int ArrayCenterPos(T * InArray, int size, T threshold);

template&lt;typename T&gt;
int ArrayCenterPos(vector&lt;T&gt; const &amp; InArray, T threshold)
{
	return ArrayCenterPos(&amp;InArray[0], (int)InArray.size(), threshold);
}

template&lt;typename T&gt;
int ArrayCenterPos(T * InArray, int size, T threshold)
{
...
}
</code></pre>
<p>gehört.</p>
<p>Die Funktionen sind in einer header Datei die in der h Datei einer Klasse geladen wird.</p>
<p>EDIT:<br />
Der Protoype und die Definition stimmen nicht überein (const)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1713604</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1713604</guid><dc:creator><![CDATA[pospiech]]></dc:creator><pubDate>Thu, 21 May 2009 08:01:41 GMT</pubDate></item></channel></rss>