<?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[Staticher Vector]]></title><description><![CDATA[<p>Hallo<br />
ich habe folgendes Problem:</p>
<p>Ich habe eine klasse &quot;Pappierkorb&quot;. In dieser klasse möchte ich ein Vector erstellen, welcher Zeiger von &quot;SDL_Surfaces&quot; enthält (ist jetzt nicht wichtig warum es dieser TYP ist). Auserdem habe ich ein paar statische Methoden geschrieben. Alles gut und schön. Aber ich bekomme immer ein Linker Error. Ich habe mich auch mal im netz schlau gemacht und habe herrausgefunden, dass man den statischen Vector vorerst initialisieren muss. Doch da liegt das Problem. Ich habe keine Ahnung, wie ich das machen soll.</p>
<p>Hier ersteinmal den Code den ich bis jetzt geschrieben habe:</p>
<pre><code class="language-cpp">#include &lt;vector&gt;
#include &quot;.\SDL_SOURCE\include\SDL.h&quot;
using namespace std;

class Pappierkorb
{
public:
   static void neueGrafik(SDL_Surface* gfx)
   {
	   grafiken.push_back(gfx);
   }

   static void loescheAlles()
   {
        ...
   }

private:
	static vector&lt;SDL_Surface *&gt; grafiken;
};
</code></pre>
<p>Folgende Meldungen bekomme ich:</p>
<blockquote>
<p>error LNK2001: Nicht aufgelöstes externes Symbol &quot;&quot;private: static class std::vector&lt;struct SDL_Surface *,class std::allocator&lt;struct SDL_Surface *&gt; &gt; Pappierkorb::grafiken&quot; (?grafiken@Pappierkorb@@0V?<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>v</mi><mi>e</mi><mi>c</mi><mi>t</mi><mi>o</mi><mi>r</mi><mi mathvariant="normal">@</mi><mi>P</mi><mi>A</mi><mi>U</mi><mi>S</mi><mi>D</mi><mi>L</mi><mi mathvariant="normal">_</mi><mi>S</mi><mi>u</mi><mi>r</mi><mi>f</mi><mi>a</mi><mi>c</mi><mi>e</mi><mi mathvariant="normal">@</mi><mi mathvariant="normal">@</mi><mi>V</mi><mo>?</mo></mrow><annotation encoding="application/x-tex">vector@PAUSDL\_Surface@@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" style="margin-right:0.03588em;">v</span><span class="mord mathit">e</span><span class="mord mathit">c</span><span class="mord mathit">t</span><span class="mord mathit">o</span><span class="mord mathit" style="margin-right:0.02778em;">r</span><span class="mord mathrm">@</span><span class="mord mathit" style="margin-right:0.13889em;">P</span><span class="mord mathit">A</span><span class="mord mathit" style="margin-right:0.10903em;">U</span><span class="mord mathit" style="margin-right:0.05764em;">S</span><span class="mord mathit" style="margin-right:0.02778em;">D</span><span class="mord mathit">L</span><span class="mord mathrm" style="margin-right:0.02778em;">_</span><span class="mord mathit" style="margin-right:0.05764em;">S</span><span class="mord mathit">u</span><span class="mord mathit" style="margin-right:0.02778em;">r</span><span class="mord mathit" style="margin-right:0.10764em;">f</span><span class="mord mathit">a</span><span class="mord mathit">c</span><span class="mord mathit">e</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@PAUSDL_Surface@@@std@@@std@@A)&quot;. button.obj</p>
</blockquote>
<blockquote>
<p>fatal error LNK1120: 1 nicht aufgelöste externe Verweise.</p>
</blockquote>
<p>Wäre schön wenn jemand eine Idee hat <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>MFg</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/232940/staticher-vector</link><generator>RSS for Node</generator><lastBuildDate>Fri, 25 Sep 2026 04:19:49 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/232940.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 29 Jan 2009 09:15:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Staticher Vector on Thu, 29 Jan 2009 09:15:08 GMT]]></title><description><![CDATA[<p>Hallo<br />
ich habe folgendes Problem:</p>
<p>Ich habe eine klasse &quot;Pappierkorb&quot;. In dieser klasse möchte ich ein Vector erstellen, welcher Zeiger von &quot;SDL_Surfaces&quot; enthält (ist jetzt nicht wichtig warum es dieser TYP ist). Auserdem habe ich ein paar statische Methoden geschrieben. Alles gut und schön. Aber ich bekomme immer ein Linker Error. Ich habe mich auch mal im netz schlau gemacht und habe herrausgefunden, dass man den statischen Vector vorerst initialisieren muss. Doch da liegt das Problem. Ich habe keine Ahnung, wie ich das machen soll.</p>
<p>Hier ersteinmal den Code den ich bis jetzt geschrieben habe:</p>
<pre><code class="language-cpp">#include &lt;vector&gt;
#include &quot;.\SDL_SOURCE\include\SDL.h&quot;
using namespace std;

class Pappierkorb
{
public:
   static void neueGrafik(SDL_Surface* gfx)
   {
	   grafiken.push_back(gfx);
   }

   static void loescheAlles()
   {
        ...
   }

private:
	static vector&lt;SDL_Surface *&gt; grafiken;
};
</code></pre>
<p>Folgende Meldungen bekomme ich:</p>
<blockquote>
<p>error LNK2001: Nicht aufgelöstes externes Symbol &quot;&quot;private: static class std::vector&lt;struct SDL_Surface *,class std::allocator&lt;struct SDL_Surface *&gt; &gt; Pappierkorb::grafiken&quot; (?grafiken@Pappierkorb@@0V?<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>v</mi><mi>e</mi><mi>c</mi><mi>t</mi><mi>o</mi><mi>r</mi><mi mathvariant="normal">@</mi><mi>P</mi><mi>A</mi><mi>U</mi><mi>S</mi><mi>D</mi><mi>L</mi><mi mathvariant="normal">_</mi><mi>S</mi><mi>u</mi><mi>r</mi><mi>f</mi><mi>a</mi><mi>c</mi><mi>e</mi><mi mathvariant="normal">@</mi><mi mathvariant="normal">@</mi><mi>V</mi><mo>?</mo></mrow><annotation encoding="application/x-tex">vector@PAUSDL\_Surface@@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" style="margin-right:0.03588em;">v</span><span class="mord mathit">e</span><span class="mord mathit">c</span><span class="mord mathit">t</span><span class="mord mathit">o</span><span class="mord mathit" style="margin-right:0.02778em;">r</span><span class="mord mathrm">@</span><span class="mord mathit" style="margin-right:0.13889em;">P</span><span class="mord mathit">A</span><span class="mord mathit" style="margin-right:0.10903em;">U</span><span class="mord mathit" style="margin-right:0.05764em;">S</span><span class="mord mathit" style="margin-right:0.02778em;">D</span><span class="mord mathit">L</span><span class="mord mathrm" style="margin-right:0.02778em;">_</span><span class="mord mathit" style="margin-right:0.05764em;">S</span><span class="mord mathit">u</span><span class="mord mathit" style="margin-right:0.02778em;">r</span><span class="mord mathit" style="margin-right:0.10764em;">f</span><span class="mord mathit">a</span><span class="mord mathit">c</span><span class="mord mathit">e</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@PAUSDL_Surface@@@std@@@std@@A)&quot;. button.obj</p>
</blockquote>
<blockquote>
<p>fatal error LNK1120: 1 nicht aufgelöste externe Verweise.</p>
</blockquote>
<p>Wäre schön wenn jemand eine Idee hat <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>MFg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1654212</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1654212</guid><dc:creator><![CDATA[Rainu]]></dc:creator><pubDate>Thu, 29 Jan 2009 09:15:08 GMT</pubDate></item><item><title><![CDATA[Reply to Staticher Vector on Thu, 29 Jan 2009 09:21:20 GMT]]></title><description><![CDATA[<p>In der cpp Datei:</p>
<pre><code class="language-cpp">vector&lt;SDL_Surface&gt; Pappierkorb::grafiken;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1654215</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1654215</guid><dc:creator><![CDATA[David_pb]]></dc:creator><pubDate>Thu, 29 Jan 2009 09:21:20 GMT</pubDate></item><item><title><![CDATA[Reply to Staticher Vector on Thu, 29 Jan 2009 09:22:02 GMT]]></title><description><![CDATA[<p>Satische Member müssen noch definiert werden. Schreib irgendwo in die cpp</p>
<pre><code class="language-cpp">vector&lt;SDL_Surface *&gt; Pappierkorb::grafiken;
</code></pre>
<p>Papier schreibt man übrigend nur mit einem p.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1654216</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1654216</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Thu, 29 Jan 2009 09:22:02 GMT</pubDate></item><item><title><![CDATA[Reply to Staticher Vector on Thu, 29 Jan 2009 09:24:40 GMT]]></title><description><![CDATA[<p>Aja .. ich danke vielmals .. es hat geklappt <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>
]]></description><link>https://www.c-plusplus.net/forum/post/1654217</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1654217</guid><dc:creator><![CDATA[Rainu]]></dc:creator><pubDate>Thu, 29 Jan 2009 09:24:40 GMT</pubDate></item><item><title><![CDATA[Reply to Staticher Vector on Thu, 29 Jan 2009 09:29:19 GMT]]></title><description><![CDATA[<p>Nochwas,<br />
Das scheint ja ein Header zu sein. Lass da bitt das <em>using namespce std;</em> weg sonst öffnest du den std-Namensraum in jeder Datei in die dieser Header inkludiert wird. Das ist nicht im Sinne des Erfinders.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1654223</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1654223</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Thu, 29 Jan 2009 09:29:19 GMT</pubDate></item></channel></rss>