<?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 Headerdateien]]></title><description><![CDATA[<p>Liebes Forum,</p>
<p>ich sitze hier gerade über einem Problem, das ich einfach nicht gelöst bekomme.<br />
Ich habe hier zwei Klassen, wovon die eine die andere einbindet, die andere allerdings nicht die Erste. Dennoch bekomme ich beim Buildvorgang immer folgende Meldung um die Ohren gehauen:</p>
<blockquote>
<p>Line 4: error2061: Syntaxfehler: Bezeichner 'Block'</p>
</blockquote>
<p>Nachfolgend noch die beiden Klassen:</p>
<p><strong>Block.h</strong>:</p>
<pre><code>#ifndef BLOCK_H
#define BLOCK_H

class Block
{
    public:
        /** Default constructor */
        Block();
        /** Default destructor */
        virtual ~Block();
        /** Gets the block´s id */
        virtual int VGetId();
        /** Renders the block */
        virtual void VRender();
    protected:
        int m_BlockId;
    private:
}

#endif // BLOCK_H
</code></pre>
<p><strong>Block.cpp</strong>:</p>
<pre><code>#include &quot;Gameplay/Objects/Block.h&quot;

Block::Block()
{
    //ctor
    this-&gt;m_BlockId = 0;
}

Block::~Block()
{
    //dtor
}

int Block::VGetId()
{
    return this-&gt;m_BlockId;
}

void Block::VRender()
{

}
</code></pre>
<p>und <strong>main.c</strong>:</p>
<pre><code>#include &lt;windows.h&gt;
#include &lt;GL/glew.h&gt;

#include &quot;Gameplay/Objects/Block.h&quot;

LRESULT CALLBACK WindowProc(HWND, UINT, WPARAM, LPARAM);
void EnableOpenGL(HWND hwnd, HDC*, HGLRC*);
void DisableOpenGL(HWND, HDC, HGLRC);

int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPSTR lpCmdLine,
                   int nCmdShow)
{
    WNDCLASSEX wcex;
    HWND hwnd;
    HDC hDC;
    HGLRC hRC;
    MSG msg;
    BOOL bQuit = FALSE;
    float theta = 0.0f;

    /* register window class */
    wcex.cbSize = sizeof(WNDCLASSEX);
    wcex.style = CS_OWNDC;
    wcex.lpfnWndProc = WindowProc;
    wcex.cbClsExtra = 0;
    wcex.cbWndExtra = 0;
    wcex.hInstance = hInstance;
    wcex.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
    wcex.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
    wcex.lpszMenuName = NULL;
    wcex.lpszClassName = &quot;CodeWorld&quot;;
    wcex.hIconSm = LoadIcon(NULL, IDI_APPLICATION);;

    if (!RegisterClassEx(&amp;wcex))
        return 0;

    /* create main window */
    hwnd = CreateWindowEx(0,
                          &quot;CodeWorld&quot;,
                          &quot;CodeWorld alpha&quot;,
                          WS_OVERLAPPEDWINDOW,
                          CW_USEDEFAULT,
                          CW_USEDEFAULT,
                          256,
                          256,
                          NULL,
                          NULL,
                          hInstance,
                          NULL);

    ShowWindow(hwnd, nCmdShow);

    /* enable OpenGL for the window */
    EnableOpenGL(hwnd, &amp;hDC, &amp;hRC);

    Tesselator *tesselator = Tesselator::Get();
    /* program main loop */
    while (!bQuit)
    {
        /* check for messages */
        if (PeekMessage(&amp;msg, NULL, 0, 0, PM_REMOVE))
        {
            /* handle or dispatch messages */
            if (msg.message == WM_QUIT)
            {
                bQuit = TRUE;
            }
            else
            {
                TranslateMessage(&amp;msg);
                DispatchMessage(&amp;msg);
            }
        }
        else
        {
            /* OpenGL animation code goes here */

            glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            glClear(GL_COLOR_BUFFER_BIT);

            glPushMatrix();
            glRotatef(theta, 1.0f, 0.0f, 0.0f);

            glBegin(GL_TRIANGLES);

                glColor3f(1.0f, 0.0f, 0.0f);   glVertex2f(0.0f,   1.0f);
                glColor3f(0.0f, 1.0f, 0.0f);   glVertex2f(0.87f,  -0.5f);
                glColor3f(0.0f, 0.0f, 1.0f);   glVertex2f(-0.87f, -0.5f);

            glEnd();

            glPopMatrix();

            SwapBuffers(hDC);

            theta += 1.0f;
            Sleep (1);
        }
    }

    /* shutdown OpenGL */
    DisableOpenGL(hwnd, hDC, hRC);

    /* destroy the window explicitly */
    DestroyWindow(hwnd);

    return msg.wParam;
}

LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg)
    {
        case WM_CLOSE:
            PostQuitMessage(0);
        break;

        case WM_DESTROY:
            return 0;

        case WM_KEYDOWN:
        {
            switch (wParam)
            {
                case VK_ESCAPE:
                    PostQuitMessage(0);
                break;
            }
        }
        break;

        default:
            return DefWindowProc(hwnd, uMsg, wParam, lParam);
    }

    return 0;
}

void EnableOpenGL(HWND hwnd, HDC* hDC, HGLRC* hRC)
{
    PIXELFORMATDESCRIPTOR pfd;

    int iFormat;

    /* get the device context (DC) */
    *hDC = GetDC(hwnd);

    /* set the pixel format for the DC */
    ZeroMemory(&amp;pfd, sizeof(pfd));

    pfd.nSize = sizeof(pfd);
    pfd.nVersion = 1;
    pfd.dwFlags = PFD_DRAW_TO_WINDOW |
                  PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
    pfd.iPixelType = PFD_TYPE_RGBA;
    pfd.cColorBits = 24;
    pfd.cDepthBits = 16;
    pfd.iLayerType = PFD_MAIN_PLANE;

    iFormat = ChoosePixelFormat(*hDC, &amp;pfd);

    SetPixelFormat(*hDC, iFormat, &amp;pfd);

    /* create and enable the render context (RC) */
    *hRC = wglCreateContext(*hDC);

    wglMakeCurrent(*hDC, *hRC);
}

void DisableOpenGL (HWND hwnd, HDC hDC, HGLRC hRC)
{
    wglMakeCurrent(NULL, NULL);
    wglDeleteContext(hRC);
    ReleaseDC(hwnd, hDC);
}
</code></pre>
<p>Ich wette, dass es sich bei meinem Problem um ein absolutes Anfänger-Problem handelt, wofür ich mich entschuldigen möchte, da ich bisher meistens Java zum Programmieren verwendet habe. Allerdings habe ich schon verzweifelt nach &quot;zirkularen Referenzen&quot; gesucht, aber keine gefunden. Habe ich was übersehen?<br />
Bitte helft mir... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /> .</p>
<p>Mit vielen, lieben Grüßen,<br />
~ EuadeLuxe ~</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/318278/problem-mit-headerdateien</link><generator>RSS for Node</generator><lastBuildDate>Mon, 27 Jul 2026 10:49:35 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/318278.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 06 Jul 2013 20:12:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit Headerdateien on Sat, 06 Jul 2013 20:12:37 GMT]]></title><description><![CDATA[<p>Liebes Forum,</p>
<p>ich sitze hier gerade über einem Problem, das ich einfach nicht gelöst bekomme.<br />
Ich habe hier zwei Klassen, wovon die eine die andere einbindet, die andere allerdings nicht die Erste. Dennoch bekomme ich beim Buildvorgang immer folgende Meldung um die Ohren gehauen:</p>
<blockquote>
<p>Line 4: error2061: Syntaxfehler: Bezeichner 'Block'</p>
</blockquote>
<p>Nachfolgend noch die beiden Klassen:</p>
<p><strong>Block.h</strong>:</p>
<pre><code>#ifndef BLOCK_H
#define BLOCK_H

class Block
{
    public:
        /** Default constructor */
        Block();
        /** Default destructor */
        virtual ~Block();
        /** Gets the block´s id */
        virtual int VGetId();
        /** Renders the block */
        virtual void VRender();
    protected:
        int m_BlockId;
    private:
}

#endif // BLOCK_H
</code></pre>
<p><strong>Block.cpp</strong>:</p>
<pre><code>#include &quot;Gameplay/Objects/Block.h&quot;

Block::Block()
{
    //ctor
    this-&gt;m_BlockId = 0;
}

Block::~Block()
{
    //dtor
}

int Block::VGetId()
{
    return this-&gt;m_BlockId;
}

void Block::VRender()
{

}
</code></pre>
<p>und <strong>main.c</strong>:</p>
<pre><code>#include &lt;windows.h&gt;
#include &lt;GL/glew.h&gt;

#include &quot;Gameplay/Objects/Block.h&quot;

LRESULT CALLBACK WindowProc(HWND, UINT, WPARAM, LPARAM);
void EnableOpenGL(HWND hwnd, HDC*, HGLRC*);
void DisableOpenGL(HWND, HDC, HGLRC);

int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPSTR lpCmdLine,
                   int nCmdShow)
{
    WNDCLASSEX wcex;
    HWND hwnd;
    HDC hDC;
    HGLRC hRC;
    MSG msg;
    BOOL bQuit = FALSE;
    float theta = 0.0f;

    /* register window class */
    wcex.cbSize = sizeof(WNDCLASSEX);
    wcex.style = CS_OWNDC;
    wcex.lpfnWndProc = WindowProc;
    wcex.cbClsExtra = 0;
    wcex.cbWndExtra = 0;
    wcex.hInstance = hInstance;
    wcex.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
    wcex.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
    wcex.lpszMenuName = NULL;
    wcex.lpszClassName = &quot;CodeWorld&quot;;
    wcex.hIconSm = LoadIcon(NULL, IDI_APPLICATION);;

    if (!RegisterClassEx(&amp;wcex))
        return 0;

    /* create main window */
    hwnd = CreateWindowEx(0,
                          &quot;CodeWorld&quot;,
                          &quot;CodeWorld alpha&quot;,
                          WS_OVERLAPPEDWINDOW,
                          CW_USEDEFAULT,
                          CW_USEDEFAULT,
                          256,
                          256,
                          NULL,
                          NULL,
                          hInstance,
                          NULL);

    ShowWindow(hwnd, nCmdShow);

    /* enable OpenGL for the window */
    EnableOpenGL(hwnd, &amp;hDC, &amp;hRC);

    Tesselator *tesselator = Tesselator::Get();
    /* program main loop */
    while (!bQuit)
    {
        /* check for messages */
        if (PeekMessage(&amp;msg, NULL, 0, 0, PM_REMOVE))
        {
            /* handle or dispatch messages */
            if (msg.message == WM_QUIT)
            {
                bQuit = TRUE;
            }
            else
            {
                TranslateMessage(&amp;msg);
                DispatchMessage(&amp;msg);
            }
        }
        else
        {
            /* OpenGL animation code goes here */

            glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            glClear(GL_COLOR_BUFFER_BIT);

            glPushMatrix();
            glRotatef(theta, 1.0f, 0.0f, 0.0f);

            glBegin(GL_TRIANGLES);

                glColor3f(1.0f, 0.0f, 0.0f);   glVertex2f(0.0f,   1.0f);
                glColor3f(0.0f, 1.0f, 0.0f);   glVertex2f(0.87f,  -0.5f);
                glColor3f(0.0f, 0.0f, 1.0f);   glVertex2f(-0.87f, -0.5f);

            glEnd();

            glPopMatrix();

            SwapBuffers(hDC);

            theta += 1.0f;
            Sleep (1);
        }
    }

    /* shutdown OpenGL */
    DisableOpenGL(hwnd, hDC, hRC);

    /* destroy the window explicitly */
    DestroyWindow(hwnd);

    return msg.wParam;
}

LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg)
    {
        case WM_CLOSE:
            PostQuitMessage(0);
        break;

        case WM_DESTROY:
            return 0;

        case WM_KEYDOWN:
        {
            switch (wParam)
            {
                case VK_ESCAPE:
                    PostQuitMessage(0);
                break;
            }
        }
        break;

        default:
            return DefWindowProc(hwnd, uMsg, wParam, lParam);
    }

    return 0;
}

void EnableOpenGL(HWND hwnd, HDC* hDC, HGLRC* hRC)
{
    PIXELFORMATDESCRIPTOR pfd;

    int iFormat;

    /* get the device context (DC) */
    *hDC = GetDC(hwnd);

    /* set the pixel format for the DC */
    ZeroMemory(&amp;pfd, sizeof(pfd));

    pfd.nSize = sizeof(pfd);
    pfd.nVersion = 1;
    pfd.dwFlags = PFD_DRAW_TO_WINDOW |
                  PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
    pfd.iPixelType = PFD_TYPE_RGBA;
    pfd.cColorBits = 24;
    pfd.cDepthBits = 16;
    pfd.iLayerType = PFD_MAIN_PLANE;

    iFormat = ChoosePixelFormat(*hDC, &amp;pfd);

    SetPixelFormat(*hDC, iFormat, &amp;pfd);

    /* create and enable the render context (RC) */
    *hRC = wglCreateContext(*hDC);

    wglMakeCurrent(*hDC, *hRC);
}

void DisableOpenGL (HWND hwnd, HDC hDC, HGLRC hRC)
{
    wglMakeCurrent(NULL, NULL);
    wglDeleteContext(hRC);
    ReleaseDC(hwnd, hDC);
}
</code></pre>
<p>Ich wette, dass es sich bei meinem Problem um ein absolutes Anfänger-Problem handelt, wofür ich mich entschuldigen möchte, da ich bisher meistens Java zum Programmieren verwendet habe. Allerdings habe ich schon verzweifelt nach &quot;zirkularen Referenzen&quot; gesucht, aber keine gefunden. Habe ich was übersehen?<br />
Bitte helft mir... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /> .</p>
<p>Mit vielen, lieben Grüßen,<br />
~ EuadeLuxe ~</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2337101</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2337101</guid><dc:creator><![CDATA[EuadeLuxe]]></dc:creator><pubDate>Sat, 06 Jul 2013 20:12:37 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Headerdateien on Sat, 06 Jul 2013 20:17:47 GMT]]></title><description><![CDATA[<p>Semikolon vergessen bei:</p>
<pre><code>struct Bla{
...
};//&lt;--- fehlt bei dir
</code></pre>
<p>Das Semikolon braucht man, weil man damit direkt Variablen deklarieren kann. Bsp:</p>
<pre><code>struct Bla{
...
}bla1, bla2; //bla1 und bla2 sind vom Typ struct Bla
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2337102</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2337102</guid><dc:creator><![CDATA[nwp3]]></dc:creator><pubDate>Sat, 06 Jul 2013 20:17:47 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Headerdateien on Sat, 06 Jul 2013 20:22:09 GMT]]></title><description><![CDATA[<p>Danke für deine schnelle Antwort, nwp3,</p>
<p>ich habe sofort ein Semikolon angefügt und das Projekt neu erstellt, allerdings bekomme ich immer noch genau dieselbe Fehlermeldung.... habe noch etwas anderes übersehen? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2337104</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2337104</guid><dc:creator><![CDATA[EuadeLuxe]]></dc:creator><pubDate>Sat, 06 Jul 2013 20:22:09 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Headerdateien on Sat, 06 Jul 2013 20:27:13 GMT]]></title><description><![CDATA[<p>Vielleicht helfen euch Informationen über meinen benutzten Compiler und die IDE weiter, ich benutze:<br />
* Den Microsoft Visual Studio 2010 Compiler,<br />
* und Code::Blocks als IDE</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2337107</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2337107</guid><dc:creator><![CDATA[EuadeLuxe]]></dc:creator><pubDate>Sat, 06 Jul 2013 20:27:13 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Headerdateien on Sat, 06 Jul 2013 21:06:23 GMT]]></title><description><![CDATA[<p>In Zeile 18 der Block.h fehlt auch ein ;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2337108</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2337108</guid><dc:creator><![CDATA[Ramanujan]]></dc:creator><pubDate>Sat, 06 Jul 2013 21:06:23 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Headerdateien on Sat, 06 Jul 2013 21:15:26 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/28594">@Ramanujan</a>: Dieses Semikolon habe ich schon angehängt, allerdings ändert dies nichts an der Fehlermeldung. Allerdings ist mir mittlerweile etwas merkwürdiges aufgefallen, was eig. für eine &quot;zirkulare Referenz&quot; sprechen würde (denke ich):<br />
Sobald ich den Include von Block.h aus main.c nehme, erhalte ich keinen Fehler mehr (kann aber natürlich auch keine Instanzen von Block erzeugen).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2337110</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2337110</guid><dc:creator><![CDATA[EuadeLuxe]]></dc:creator><pubDate>Sat, 06 Jul 2013 21:15:26 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Headerdateien on Sat, 06 Jul 2013 22:02:17 GMT]]></title><description><![CDATA[<p>Liebes Forum,</p>
<p>ich danke euch für eure Hilfe, ich habe das Problem jetzt lösen können:<br />
Nachdem ich ein neues Projekt erstellt und die Dateien (außer main.<strong>c</strong>) importiert hatte, habe ich eine Datei mit dem Namen main.<strong>cpp</strong>) erstellt, und siehe da, es geht. Warum ist mir leider noch unklar, vllt. könnt ihr mir sagen warum es nun auf einmal funktioniert?</p>
<p>Mit vielen, lieben Grüßen,<br />
~ EuadeLuxe ~</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2337114</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2337114</guid><dc:creator><![CDATA[EuadeLuxe]]></dc:creator><pubDate>Sat, 06 Jul 2013 22:02:17 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Headerdateien on Sat, 06 Jul 2013 22:25:19 GMT]]></title><description><![CDATA[<p>Weil main.c durch den C-Compiler gejagt wird. In C gibt es keine Klassen, daher ist die Syntax unbekannt -&gt; Fehlermeldungen. Durch .cpp weiß deine IDE, dass er den C++-Compiler verwenden muss.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2337120</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2337120</guid><dc:creator><![CDATA[theliquidwave]]></dc:creator><pubDate>Sat, 06 Jul 2013 22:25:19 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Headerdateien on Sun, 07 Jul 2013 10:01:38 GMT]]></title><description><![CDATA[<p>Danke, theliquidwave,</p>
<p>jetzt weiß ich ja, was ich das nächste Mal zu tun habe. Das hat mir echt Kopfzerbrechen bereitet. Jetzt muss ich nur noch rausfinden, wie ich die Datei in meinem Projekt umbenenne in Code::Blocks. Nach mal vielen, lieben Dank euch allen. <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>Liebe Grüße,<br />
~ EuadeLuxe ~</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2337199</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2337199</guid><dc:creator><![CDATA[EuadeLuxe]]></dc:creator><pubDate>Sun, 07 Jul 2013 10:01:38 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Headerdateien on Sun, 07 Jul 2013 11:24:15 GMT]]></title><description><![CDATA[<p>Maybe your computer is hacked! lol</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2337218</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2337218</guid><dc:creator><![CDATA[Kenner der Ursache]]></dc:creator><pubDate>Sun, 07 Jul 2013 11:24:15 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Headerdateien on Sun, 07 Jul 2013 12:43:10 GMT]]></title><description><![CDATA[<p>YES WE SCAN !</p>
<p>thanks obama</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2337230</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2337230</guid><dc:creator><![CDATA[Skym0sh0]]></dc:creator><pubDate>Sun, 07 Jul 2013 12:43:10 GMT</pubDate></item></channel></rss>