Out-of-line definition of "OpenDoor" does not match any declaration on "UOpenDoor"

I’m at my wits end right here. I’m fairly sure I’ve copied Ben’s code exactly, except I declared OpenDoor as void in the header because it threw an error when I did it (how did Ben’s code compile without declaring it?)
My header file followed by my cpp file:

![50 PM|690x404]
(/uploads/db2322/original/3X/e/9/e99ce43bd5aa4ed426bcc6ebc9341b3743eddc03.png)


Anyways, any help would be appreciated!

The error message itself is very helpful here. It’s looking for the declaration of the constructor of UOpenDoor but can’t find it in the header file. In other words, you’re telling the compiler to define something ( in the .cpp file) that you never declared in the first place (in the .h file). So in the header file, declare the constructor within the class UOpenDoor (under the public region) like so:

UOpenDoor();

This should solve the problem. Let me know if that does the trick!

Lastly, visual studio’s error messages are usually descriptive enough to fix the problem. Learning to read them and understand them is an incredibly helpful skill to have. I recommend googling the exact wording of the error message in the future, you’ll learn what they mean in no time. Additionally, I’d be happy to explain this one if my above explanation isn’t helpful.

Thank you. I understand :slight_smile:

Privacy & Terms