Having problems with Character.cpp

I have been encountering errors in Character.cpp to do with the tick function but the program has still been working as intended until trying to create the map bounds. I have tried rewriting the section, compared my code to the repository but for the life of me I can’t figure out the problem.




The error I get hovering over ‘Character’ in void Character::tick(float deltaTime); is “Declaration of ‘void Character::tick(float)’ outside of class is not definition [-fpermissive] gcc”

and hovering over ‘tick’ "member function "Character::tick: may not be redeclared outside its class C/C++(392)

Hello Chump,

This looks like it’s going to be one of those tricky ones with no immediately obvious solution. Can you upload your project using this form and I’ll be able to provide a solution after looking it over.

Thanks Chump, I was able to confirm the issue and find the solution.

There were two errors with your code, both in Character.cpp.

The first is on line 17, where you have a semi-colon at the end of your function declaration void Character::tick(float deltaTime);. That semi-colon signifies the end of a statement and confuses the compiler into thinking that there’s no definition for the function (which is in the brackets immediately below). Removing that semi-colon fixes the first problem.

The second is on line 57, void Characcter::undoMovement(), which is just a misspelling of “Character”. Changing it to void Character::undoMovement() solves the issue.

Afterwards, you’ll be able to compile and test your game. I didn’t look for any additional issues once I was able to compile and launch.

Yep that fixed it thanks for the help!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms