Bernard van Tonder
Bernard van Tonder

Reputation: 21

C++ class not found despite header being included

As far as I could find out, C++ is not recognising my Unit class. I am sure I included it correctly in my GameMaster.h . I tried forward declaring but it had no effect. It seems to be linked correctly with makefile. Where could the error lie?

GameMaster.cpp:21:34: error: expected primary-expression before ‘*’ token
if (combatHandler.isEnemies(Unit* attackingUnit, Unit* defendingUnit))

code:

 if (combatHandler.isEnemies(Unit* attackingUnit, Unit* defendingUnit))

Upvotes: 0

Views: 784

Answers (1)

Bo Persson
Bo Persson

Reputation: 92211

When you are calling the functions, you should not give the parameter types, just their values. Perhaps like this

if (combatHandler.isEnemies(&attackingUnit, &defendingUnit))

Upvotes: 4

Related Questions