Jump to content
  • Advertisement
Sign in to follow this  
Niddles

Code::Blocks errors.

This topic is 4432 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone, I recently downloaded code::blocks, and it is giving my program that worked in dev-cpp problems. In this header file (cclass.h), it says Line 15: Syntax Error before "cWindow" Line 16: Syntax Error before '{' token Line 28: Syntax Error before ':' token line 30: Warning: data definition has no type of storage class line 33: Warning: data definition has no type of storage class line 34: Syntax Error before '}' token
#ifndef _CCLASS_H
#define _CCLASS_H
#include <windows.h>
#include <GL/gl.h>
#define WCEXTRA 0
#define WWEXTRA 0
#define WMENU NULL
#define WIDTH 800
#define HEIGHT 600
#define INITX 0
#define INITY 0
#define COLORBITS 24
#define DEPTHBITS 16

class cWindow //this line
{            //this line
    private:
        int width;
        int height;
        PIXELFORMATDESCRIPTOR pfd;
        int iFormat;
        HWND hWnd;
        HDC *hDC;
        HGLRC *hRC;
        WNDCLASS wc;
        HINSTANCE hInst;
        void DisableOpenGL();
    public:          //this line
        MSG msg;
        bool running; //this line
        void EnableOpenGL();
        void CleanUp();
        cWindow(HINSTANCE hInstance, char* className, char* appName); //this line
};           //this line
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);

#endif

And also in my main program file, it is giving errors too. Line 12: Syntax Error before "myWindow" Line 13: myWindow undeclared Line 20: false undeclared
#include <windows.h>
#include <GL/gl.h>
#define CLASSNAME  "cclass"
#define APPNAME "My Class"
#include "cclass.h"

int WINAPI WinMain (HINSTANCE hInstance,
                    HINSTANCE hPrevInstance,
                    LPSTR lpCmdLine,
                    int iCmdShow)
{
    cWindow myWindow(hInstance, CLASSNAME, APPNAME); //this line
    myWindow.EnableOpenGL(); //this line
    while (myWindow.running)
    {
        if (PeekMessage (&myWindow.msg, NULL, 0, 0, PM_REMOVE))
        {
            if (myWindow.msg.message == WM_QUIT)
            {
                myWindow.running = false; //and this line
            }
            else
            {
                TranslateMessage (&myWindow.msg);
                DispatchMessage (&myWindow.msg);
            }
        }
    }
    myWindow.CleanUp();
    return myWindow.msg.wParam;
}

Could someone help me out on this please? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
You may have to tweak your build references - judging from the fact the 'class', 'bool' and 'false' keywords aren't recognized, Code::Blocks is probably trying to build it as a C program.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!