• Advertisement
Sign in to follow this  

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

This topic is 1980 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

For some reason when i try to compile my code I get the error message:

C:\CPPProject\GameEngine.h|4|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'GameEngine'|
[/quote]
I have setup my compiler and linker settings correctly.

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

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
Advertisement
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:

#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


or


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

Share this post


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

  • Advertisement