<?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[namespace und extern]]></title><description><![CDATA[<p>Hallo an alle,</p>
<p>ich habe das Problem, dass ich eine Funktion die<br />
in einem namespace später definiert wird aufrufen möchte.<br />
Hier ein Beispiel, ich möchte die Testfunktion() aufrufen.<br />
Ich habe einige extern- Varianten ausprobiert, komme aber nicht<br />
auf die Lösung.</p>
<pre><code class="language-cpp">void EineFunktion()
{
   // wie kann man hier Testfunktion() aufrufen ???
   Test::Testfunktion(); // &lt;- geht nicht!
}

namespace Test
{
   void Testfunktion()
   {
   }
}
</code></pre>
<p>Gruss CUlli</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/225165/namespace-und-extern</link><generator>RSS for Node</generator><lastBuildDate>Thu, 01 Oct 2026 12:04:57 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/225165.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 20 Oct 2008 13:12:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to namespace und extern on Mon, 20 Oct 2008 13:12:11 GMT]]></title><description><![CDATA[<p>Hallo an alle,</p>
<p>ich habe das Problem, dass ich eine Funktion die<br />
in einem namespace später definiert wird aufrufen möchte.<br />
Hier ein Beispiel, ich möchte die Testfunktion() aufrufen.<br />
Ich habe einige extern- Varianten ausprobiert, komme aber nicht<br />
auf die Lösung.</p>
<pre><code class="language-cpp">void EineFunktion()
{
   // wie kann man hier Testfunktion() aufrufen ???
   Test::Testfunktion(); // &lt;- geht nicht!
}

namespace Test
{
   void Testfunktion()
   {
   }
}
</code></pre>
<p>Gruss CUlli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1601678</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1601678</guid><dc:creator><![CDATA[CUlli]]></dc:creator><pubDate>Mon, 20 Oct 2008 13:12:11 GMT</pubDate></item><item><title><![CDATA[Reply to namespace und extern on Mon, 20 Oct 2008 13:14:37 GMT]]></title><description><![CDATA[<p>Vorher deklarieren.</p>
<pre><code class="language-cpp">namespace Test
{
   void Testfunktion();
}

void EineFunktion()
{
   Test::Testfunktion();
}

namespace Test
{
   void Testfunktion()
   {
   }
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1601682</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1601682</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Mon, 20 Oct 2008 13:14:37 GMT</pubDate></item><item><title><![CDATA[Reply to namespace und extern on Mon, 20 Oct 2008 13:29:11 GMT]]></title><description><![CDATA[<p>Danke fuer die schnelle Antwort,<br />
sieht gut aus,<br />
wieder dazu gelernt.</p>
<p>Gruss CUlli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1601693</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1601693</guid><dc:creator><![CDATA[CUlli]]></dc:creator><pubDate>Mon, 20 Oct 2008 13:29:11 GMT</pubDate></item><item><title><![CDATA[Reply to namespace und extern on Tue, 21 Oct 2008 16:42:33 GMT]]></title><description><![CDATA[<p>ich klinke mich hier mal mit ein, da ich ein ähnliches problem habe.<br />
ich habe in zwei verschiedenen headern in jeweils verschiedenen namespaces klassen deklariert. eine der beiden klassen verwendet die andere, allerdings bekomme ich dann fehlermeldungen, wie z.B. das n2 keine klasse oder namespace ist. folgendes Beispiel:</p>
<pre><code class="language-cpp">//header h1.h
namespace n1
{
  class c1
  {
    //...
  };
};

//header h2.h
#include &quot;h1.h&quot;

namespace n2
{
  class c2
  {
    void foo(n1::c1 const &amp;src) //hier meckert er, dass &quot;'n1' : is not a class or namespace name&quot;
    {
      //...
    };
    //...
  };
};
</code></pre>
<p>wäre für rat sehr dankbar.<br />
PS: ohne namespaces hatte es funktioniert, wollte halt der besseren strukturierung und einteilung namespaces einbauen und dann bekomme ich solche fehler <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="😞"
    /><br />
bei mir sind das auch noch template-klassen, aber das sollte ja nicht das problem sein!?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1602381</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1602381</guid><dc:creator><![CDATA[StarCraftFeuerteufel]]></dc:creator><pubDate>Tue, 21 Oct 2008 16:42:33 GMT</pubDate></item><item><title><![CDATA[Reply to namespace und extern on Tue, 21 Oct 2008 16:44:34 GMT]]></title><description><![CDATA[<p>kann es sein, dass dein h1 auch h2 inkludiert, du also eine zirkuläre includebeziehung hast?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1602384</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1602384</guid><dc:creator><![CDATA[vlad_tepesch]]></dc:creator><pubDate>Tue, 21 Oct 2008 16:44:34 GMT</pubDate></item><item><title><![CDATA[Reply to namespace und extern on Tue, 21 Oct 2008 16:48:30 GMT]]></title><description><![CDATA[<p>nein das passiert nicht, darauf hab ich schon geachtet. dann hätte es ja vorher (also ohne namespaces) ja auch nicht funktioniert, würde ich jetzt mal schätzen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1602389</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1602389</guid><dc:creator><![CDATA[StarCraftFeuerteufel]]></dc:creator><pubDate>Tue, 21 Oct 2008 16:48:30 GMT</pubDate></item><item><title><![CDATA[Reply to namespace und extern on Tue, 21 Oct 2008 19:26:28 GMT]]></title><description><![CDATA[<p>ähnlich probleme treten auch bei folgendem auf</p>
<pre><code class="language-cpp">//header h1.h
//wie oben

//header h3.h
#include &quot;h1.h&quot;

namespace n3
{
  class c3 :
    virtual public n1::c1
  {
    //...
  };
};
</code></pre>
<p>könnte es auch probleme geben wenn man namespaces in einander schachtelt?<br />
also zb.</p>
<pre><code class="language-cpp">//header h0.h
namespace n0
{
  namespace n1
  {
    class c1
    {
      //...
    };
  };
};

//header h4.h
#include &quot;h0.h&quot;

namespace n4
{
  class c2 : 
    virtual public n0::n1::c1
  {
    //...
  };
};
</code></pre>
<p>sowas hab ich nämlich auch. da ich ziemlich viel aufeinmal geändert habe, würde ich zumindest gerne ein paar fehlerquellen ausschließen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1602465</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1602465</guid><dc:creator><![CDATA[StarCraftFeuerteufel]]></dc:creator><pubDate>Tue, 21 Oct 2008 19:26:28 GMT</pubDate></item><item><title><![CDATA[Reply to namespace und extern on Wed, 22 Oct 2008 08:18:43 GMT]]></title><description><![CDATA[<p>Bist du sicher, dass du nirgends einen Schreibfehler drin hast?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1602645</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1602645</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Wed, 22 Oct 2008 08:18:43 GMT</pubDate></item><item><title><![CDATA[Reply to namespace und extern on Wed, 22 Oct 2008 10:42:51 GMT]]></title><description><![CDATA[<p>eigentlich schon <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="🙂"
    /><br />
aber wie ich mich kenne wird irgendwo über 3 ecken wieder ein fehler drin sein, ich mache mal eine schritt für schritt analyse, aller header, etc.. dann wird sich ja zeigen wo der übeltäter sitzt <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1602745</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1602745</guid><dc:creator><![CDATA[StarCraftFeuerteufel]]></dc:creator><pubDate>Wed, 22 Oct 2008 10:42:51 GMT</pubDate></item><item><title><![CDATA[Reply to namespace und extern on Wed, 22 Oct 2008 10:51:53 GMT]]></title><description><![CDATA[<p>Das einzige Problem, welches mir bei sowas in den Sinn kommt, wenn du wirklich keine zirkuläre Includebeziehung hast, wäre folgendes:</p>
<pre><code class="language-cpp">//header h0.h 
namespace n0
{
  class c1
  {
    //...
  };
}

//header h4.h
#include &quot;h0.h&quot;

namespace n1
{
  namespace n0
  {
    // ...
  }

  class c2 : virtual public n0::c1
  { 
    //... 
  }; 
}
</code></pre>
<p><code>n0::c1</code> würde hier nicht erkennt werden, weil der namespace <code>n1::n0</code> gemeint würde und somit die Klasse <code>n1::n0::c1</code> . Abhilfe bei sowas würde das folgende geben: <code>::n0::c1</code> . Durch den Globaloperator wird direkt im globalen <code>namespace</code> nach dem <code>namespace n0</code> gesucht.</p>
<p>Grüssli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1602749</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1602749</guid><dc:creator><![CDATA[Dravere]]></dc:creator><pubDate>Wed, 22 Oct 2008 10:51:53 GMT</pubDate></item><item><title><![CDATA[Reply to namespace und extern on Wed, 22 Oct 2008 18:53:28 GMT]]></title><description><![CDATA[<p>also ich habs jetzt hinbekommen, eine zirkuläre &quot;includierung&quot; war es nicht, hatte einfach nur in einigen anderen headern bei klassen aus anderen namespaces diese vergessen mit anzugeben. ich denke mal daran lags, jedenfalls funktioniert jetzt alles. danke trotzdem</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1603042</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1603042</guid><dc:creator><![CDATA[StarCraftFeuerteufel]]></dc:creator><pubDate>Wed, 22 Oct 2008 18:53:28 GMT</pubDate></item><item><title><![CDATA[Reply to namespace und extern on Thu, 23 Oct 2008 08:10:16 GMT]]></title><description><![CDATA[<p>FreakyBKA schrieb:</p>
<blockquote>
<p>also ich habs jetzt hinbekommen, eine zirkuläre &quot;includierung&quot; war es nicht, hatte einfach nur in einigen anderen headern bei klassen aus anderen namespaces diese vergessen mit anzugeben. ich denke mal daran lags, jedenfalls funktioniert jetzt alles. danke trotzdem</p>
</blockquote>
<p>Da war ich mit meiner Vermutung gar nicht mal so weit weg.. <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/1603218</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1603218</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Thu, 23 Oct 2008 08:10:16 GMT</pubDate></item></channel></rss>