<?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 mit namespace]]></title><description><![CDATA[<p>Hallo zusammen,<br />
ich habe den folgenden Code geschrieben:</p>
<pre><code class="language-cpp">// Utils.h
...
namespace ge {
    float FloatRandom(...);
}
</code></pre>
<pre><code class="language-cpp">//Utils.cpp
float ge::FloatRandom(...)
{
...
}
</code></pre>
<pre><code class="language-cpp">//Vector2.h
...{ge::FloatRandom(...)}
</code></pre>
<p>Von VidualC++2010 bekomme ich jedoch die Fehlermaldung, dass FloatRandom kein Element von ge sei. Die Datei Utils.h ist in Vector2.h eingebunden.<br />
Ich hoffe, mir kann jemand helfen.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/292855/problem-mit-namespace</link><generator>RSS for Node</generator><lastBuildDate>Sun, 16 Aug 2026 14:04:33 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/292855.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 19 Sep 2011 11:38:47 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit namespace on Mon, 19 Sep 2011 11:38:47 GMT]]></title><description><![CDATA[<p>Hallo zusammen,<br />
ich habe den folgenden Code geschrieben:</p>
<pre><code class="language-cpp">// Utils.h
...
namespace ge {
    float FloatRandom(...);
}
</code></pre>
<pre><code class="language-cpp">//Utils.cpp
float ge::FloatRandom(...)
{
...
}
</code></pre>
<pre><code class="language-cpp">//Vector2.h
...{ge::FloatRandom(...)}
</code></pre>
<p>Von VidualC++2010 bekomme ich jedoch die Fehlermaldung, dass FloatRandom kein Element von ge sei. Die Datei Utils.h ist in Vector2.h eingebunden.<br />
Ich hoffe, mir kann jemand helfen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2121220</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2121220</guid><dc:creator><![CDATA[NikSg]]></dc:creator><pubDate>Mon, 19 Sep 2011 11:38:47 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit namespace on Mon, 19 Sep 2011 12:04:43 GMT]]></title><description><![CDATA[<p>Das was du in der Utils.cpp machst, ist auf jeden Fall falsch. Du verwechselst da wohl Memberfunktionen mit namespaces. Das sollt aber eigentlich die Vector2.h nicht stören. Daher die Vermutung, dass der Fehler irgendwo in deinen ... liegt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2121227</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2121227</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 19 Sep 2011 12:04:43 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit namespace on Mon, 19 Sep 2011 12:35:09 GMT]]></title><description><![CDATA[<p>ok, hier mal der gesamte code:</p>
<pre><code class="language-cpp">//Utils.cpp
GE_API float ge::FloatRandom(const float fMin, const float fMax)
{
	return fMin + (fMax - fMin) * ((float)(rand() %10001) / 10000.0f);
}
</code></pre>
<pre><code class="language-cpp">//Vector2.h
inline Vector2 Vector2Random()
	{
		return Vector2NormalizeEx(Vector2(ge::FloatRandom(-1.0f, 1.0f), ge::FloatRandom(-1.0f, 1.0f)));
	}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2121240</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2121240</guid><dc:creator><![CDATA[NikSg]]></dc:creator><pubDate>Mon, 19 Sep 2011 12:35:09 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit namespace on Mon, 19 Sep 2011 13:02:13 GMT]]></title><description><![CDATA[<p>NikSg schrieb:</p>
<blockquote>
<p>ok, hier mal der gesamte code:</p>
</blockquote>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /> Bring doch mal ein minimales, compilierbares (bis auf den Fehler) Beispiel mit klarer Fehlermeldung und Zeile des Fehlers. Sonst ist das vollkommen nutzlos. Was soll zum Beispiel die (wie schon erwähnt ohnehin fehlerhafte) Utils.cpp überhaupt mit dem Problem zu tun haben?</p>
<p>P.S.: Das sieht übrigens schwer danach aus, als würdest du die <a href="http://www.johndcook.com/cpp_TR1_random.html" rel="nofollow">Standardbibliothek</a> nachprogrammieren. (Der Artikel ist nicht ganz aktuell, das was tr1 war ist nun Teil des neuen 2011er Standards)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2121258</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2121258</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 19 Sep 2011 13:02:13 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit namespace on Mon, 19 Sep 2011 13:15:05 GMT]]></title><description><![CDATA[<p>Der inhalt von Utils.h und Utils.cpp Ist genauso, wie oben, abgesehen davon dass in Utis.cpp Utiös.h eingebunden werden muss.<br />
main.cpp (statt vector2.h)</p>
<pre><code class="language-cpp">// main.h
#include &quot;Utils.h&quot;

int main(void)
{
	float fRandom;
	fRandom = ge::FloatRandom(-1.0f, 1.0f);
	return 0;
}
</code></pre>
<p>Fehlermeldung:<br />
main.cpp(7): error C3861: &quot;FloatRandom&quot;: Bezeichner wurde nicht gefunden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2121265</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2121265</guid><dc:creator><![CDATA[NikSg]]></dc:creator><pubDate>Mon, 19 Sep 2011 13:15:05 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit namespace on Mon, 19 Sep 2011 13:31:32 GMT]]></title><description><![CDATA[<p>Muss du nicht in util.cpp #include &quot;Utils.h&quot; noch einfügen ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2121277</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2121277</guid><dc:creator><![CDATA[~#~]]></dc:creator><pubDate>Mon, 19 Sep 2011 13:31:32 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit namespace on Mon, 19 Sep 2011 13:34:27 GMT]]></title><description><![CDATA[<p>Und du brauchst doch noch using namespace ge;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2121281</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2121281</guid><dc:creator><![CDATA[#~#]]></dc:creator><pubDate>Mon, 19 Sep 2011 13:34:27 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit namespace on Mon, 19 Sep 2011 13:36:11 GMT]]></title><description><![CDATA[<p>Hab ich. Ich hab oben ja auch geschrieben, dass die noch eingunden werden muss. Mein Problem: Wenn ich die Funktion FloatRandom aufruffen will, unt ge:: schreibe, zeigt mir intelligenmce die entsprechende Fun ktion an, beim Compilen sagt mir VS aber, dass die Funktion nicht zu ge gehöhren würde.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2121282</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2121282</guid><dc:creator><![CDATA[NikSg]]></dc:creator><pubDate>Mon, 19 Sep 2011 13:36:11 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit namespace on Mon, 19 Sep 2011 13:38:50 GMT]]></title><description><![CDATA[<p>Das hört sich ziehmlich komisch an.Probier mal die funktion nur in der header datei zu bauen , also alles as jetzt in utils.cpp in die h datei tun.Ist sicher eine schlechte Lösung , aber ist ja nur ein versuch</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2121285</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2121285</guid><dc:creator><![CDATA[~#~]]></dc:creator><pubDate>Mon, 19 Sep 2011 13:38:50 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit namespace on Mon, 19 Sep 2011 13:41:22 GMT]]></title><description><![CDATA[<p>das hat das Problem leider auch nicht gelößt</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2121286</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2121286</guid><dc:creator><![CDATA[NikSg]]></dc:creator><pubDate>Mon, 19 Sep 2011 13:41:22 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit namespace on Mon, 19 Sep 2011 13:42:57 GMT]]></title><description><![CDATA[<p>So sollte es eig. gehen :</p>
<p>.h</p>
<pre><code class="language-cpp">namespace leet
{
class fanboy
{
public :
int a;

void crew(int a);
}
}
</code></pre>
<p>.cpp</p>
<pre><code class="language-cpp">using namespace leet;

void fanboy::crew ....
</code></pre>
<p>main.cpp</p>
<pre><code class="language-cpp">using namespace leet;
fanboy f;
f.crew();
</code></pre>
<p>wenn ich das so mache , dan gehts</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2121288</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2121288</guid><dc:creator><![CDATA[#~#]]></dc:creator><pubDate>Mon, 19 Sep 2011 13:42:57 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit namespace on Mon, 19 Sep 2011 13:46:13 GMT]]></title><description><![CDATA[<p>Es muss gehen <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/2121289</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2121289</guid><dc:creator><![CDATA[~#~]]></dc:creator><pubDate>Mon, 19 Sep 2011 13:46:13 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit namespace on Sun, 25 Sep 2011 17:59:29 GMT]]></title><description><![CDATA[<p>Ich hab dasselbe Problem jetzt mit einer Klasse:</p>
<pre><code class="language-cpp">namespace ge
{
	class GE_API Matrix;

	class GE_API Vector2
	{
	public:
		union
		{
			struct
			{
				float x;
				float y;
			};

			struct
			{
				float u;
				float v;
			};

			float c[2];
		};

		Vector2() {};
		Vector2(const Vector2&amp; v) : x(v.x), y(v.y) {}
		Vector2(const float f) : x(f), y(f) {}
		Vector2(float _x, float _y) : x(_x), y(_y) {}
		Vector2(float* pfComponent) : x(pfComponent[0]), y(pfComponent[1]) {}

		operator float* () {return (float*)(c);}

		Vector2&amp; operator  = (const Vector2&amp; v) {x = v.x; y = v.y; return *this;}
		Vector2&amp; operator += (const Vector2&amp; v) {x += v.x; y += v.y; return *this;}
		Vector2&amp; operator -= (const Vector2&amp; v) {x -= v.x; y -= v.y; return *this;}
		Vector2&amp; operator *= (const Vector2&amp; v) {x *= v.x; y *= v.y; return *this;}
		Vector2&amp; operator *= (const float f) { x *= f; y *= f; return *this;}
		Vector2&amp; operator /= (const Vector2&amp; v) { x /= v.x; y /= v.y; return *this;}
		Vector2&amp; operator /= (const float f) {x /= f; y /= f; return *this;}
	};
</code></pre>
<pre><code class="language-cpp">// Direct3D.h
#ifndef _DIRECT3D_H
#define _DIRECT3D_H

#include &quot;GraphicEngine.h&quot;

namespace ge
{
	union GE_API D3DRS
	{
		DWORD adwRS[210];
		float afRS[210];
	};

	union GE_API D3DTSS
	{
		DWORD adwTSS[8][33];
		float afTSS[8][33];
	};

	union GE_API D3DSS
	{
		DWORD adwSS[8][14];
		float afSS[8][14];
	};

	class GE_API Direct3D
	{
	public:
		bool m_bInitialized;
		HWND m_hWindow;
		bool m_bOwnWindow;
		PDIRECT3D9 m_pD3D;
		PDIRECT3DDEVICE9 m_pD3DDevice;
		D3DCAPS9 m_Caps;
		D3DPRESENT_PARAMETERS m_PresentParameters;
		ge::Vector2 m_vScreenSize;
		geResult m_PresentResult;

		D3DRS m_RS;
		D3DTSS m_TSS;
		D3DSS m_SS;

		DWORD m_dwFVF;
		PDIRECT3DBASETEXTURE9 m_apTexture[8];
		bool m_abIsRS[210];
		bool m_abIsTSS[33];
		bool m_abIsSS[14];

		Direct3D() {};

	public:
		~Direct3D() {if(IsInitialized()) Exit();}

		geResult Init(DMXConfig* pConfig,
					  char* pcWindowTitle,
					  HWND hOwnWindow = NULL,
					  HICON hIcon = NULL);
		geResult Exit();
		geResult Capture();
		geResult Present();
		geResult SetRS(D3DRENDERSTATETYPE RS, DWORD dwValue);
		geResult SetRSF(D3DRENDERSTATETYPE RS, float fValue);
		DWORD GetRS(D3DRENDERSTATETYPE RS);
		float GetRSF(D3DRENDERSTATETYPE RS);
		geResult SetTSS(DWORD dwStage, D3DTEXTURESTAGESTATETYPE TSS, DWORD dwValue);
		geResult SetTSSF(DWORD dwStage, D3DTEXTURESTAGESTATETYPE TSS, float fValue);
		DWORD GetTSS(DWORD dwStage, D3DTEXTURESTAGESTATETYPE TSS);
		float GetTSSF(DWORD dwStage, D3DTEXTURESTAGESTATETYPE TSS);
		geResult SetSS(DWORD dwStage, D3DSAMPLERSTATETYPE SS, DWORD dwValue);
		geResult SetSSF(DWORD dwStage, D3DSAMPLERSTATETYPE SS, float fValue);
		DWORD GetSS(DWORD dwStage, D3DSAMPLERSTATETYPE SS);
		float GetSSF(DWORD dwStage, D3DSAMPLERSTATETYPE SS);
		geResult SetTexture(DWORD dwStage,
							PDIRECT3DBASETEXTURE9 pTesture);
		PDIRECT3DBASETEXTURE9 GetTexture(DWORD dwStage);
		geResult SetTransform(D3DTRANSFORMSTATETYPE Transform, const Matrix&amp; mMatrix);
		Matrix GetTransform(D3DTRANSFORMSTATETYPE Transform);
		geResult SetFVF(DWORD dwFVF);

		PDIRECT3DDEVICE9 operator -&gt; () {return m_pD3DDevice;}

		HWND GetWindow() {return m_hWindow;}
		bool GetOwnWindow() {return m_bOwnWindow;}
		PDIRECT3D9 GetD3D() {return m_pD3D;}
		PDIRECT3DDEVICE9 GetDevice() {return m_pD3DDevice;}
		DWORD getFVF() {return m_dwFVF;}
		const D3DCAPS9&amp; GetCaps() {return m_Caps;}
		const D3DPRESENT_PARAMETERS&amp; GetPresentParameters() {return m_PresentParameters;}
		const Vector2&amp; GetScreenSize() {return m_vScreenSize;}
		float GetAspect() {return m_vScreenSize.x / m_vScreenSize.y;}
		geResult GetPresentResult() {return m_PresentResult;}

		static Direct3D&amp; Instance();
		static bool IsInitialized() {return Instance().m_bInitialized;}

		friend LRESULT WINAPI WindowProc(HWND hWnd,
										 unsigned int uiMessage,
										 WPARAM WParam,
										 LPARAM LParam);
	};
}

#endif
</code></pre>
<p>Fehlermelung:</p>
<blockquote>
<p>direct3d.h(39): error C2039: 'Vector2': Ist kein Element von 'ge'<br />
direct3d.h(39): error C2146: Syntaxfehler: Fehlendes ';' vor Bezeichner 'm_vScreenSize'<br />
direct3d.h(39): error C4430: Fehlender Typspezifizierer - int wird angenommen. Hinweis: &quot;default-int&quot; wird von C++ nicht unterstützt.</p>
</blockquote>
<p>Bevor jemand was sagt: Ja, ich weiß dass die Member in Direct3D public deklariert sind, werd das noch ändern.<br />
Ich hoffe, jemand kann mir sagen, was ich falsch gemacht hab.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2123555</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2123555</guid><dc:creator><![CDATA[NikSg]]></dc:creator><pubDate>Sun, 25 Sep 2011 17:59:29 GMT</pubDate></item></channel></rss>