cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
expected class-name before ‘{’ token
expected class-name before ‘{’ token
Nov 14, 2019 at 12:50pm UTC
AL88
(146)
Why am I getting :
Player.h:15:1: error: expected class-name before ‘{’ token
Enemy.h:9:1: error: expected class-name before ‘{’ token
in my game engine code?
Thanks
https://drive.google.com/open?id=1GR3JDE63E0FUZuvk4gezq_Md8JNZM3pT
Nov 14, 2019 at 1:21pm UTC
coder777
(8439)
You problem is
#include "Game.h"
in SDLGameObject.h. It creates circular dependencies. Since it's unnecessary just remove it.
Nov 15, 2019 at 1:20pm UTC
AL88
(146)
Then I can't compile line 19 "TheGame::Instance()" on line 19 SDLGameObject.cpp. Would I have to use forward declaration instead? can you show me where and how? thanks.
Nov 15, 2019 at 1:41pm UTC
coder777
(8439)
No forward declaration. Just #include "Game.h" into the SDLGameObject.cpp. On the one side.
On the other side
TheGame::Instance()->getRenderer());
seems unnecessary.
Topic archived. No new replies allowed.