Sign in to follow this  
Registered User

C:\CPPProject\GameEngine.h|4|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'GameEngine'|

Recommended Posts

For some reason when i try to compile my code I get the error message:
[quote]
C:\CPPProject\GameEngine.h|4|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'GameEngine'|
[/quote]
I have setup my compiler and linker settings correctly.
[code]
Compiler & Debugger Settings ->Linker Settings->Other Linker Settings: -lmingw32 -lSDLmain -lSDL

Compiler & Debugger Settings ->Search Directory->Compiler: C:\CodeBlocks\SDL\include

Compiler & Debugger Settings ->Search Directory->Linker: C:\CodeBlocks\SDL\lib
[/code]
I am using CodeBlocks 10.05 and installed SDL via the DevPaks installer. .Any assistance would be greatly appreciated.

Sincerely,

Registered User Edited by Registered User

Share this post


Link to post
Share on other sites
The GameEngine.h file is compiled as C code because of the main.c file which includes it. Try renaming that file to main.cpp. Also you should put header guards in the GameEngine.h file:
[CODE]
#ifndef GAMEENGINE_H
#define GAMEENGINE_H
// include required libraries
#include <SDL.h>
class GameEngine
{
private:
// screen display surface
// SDL_Surface* Screen;
public:
bool init();
void run();
};
#endif
[/CODE]

or

[CODE]
#pragma once
// include required libraries
#include <SDL.h>
class GameEngine
{
private:
// screen display surface
// SDL_Surface* Screen;
public:
bool init();
void run();
};
[/CODE] Edited by brx

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this