Cannot compile nor open project in unreal

Hey there, begginer here.
Placed a door, trigger volume that opens it after you go over it by adding a c++ component. Works great, but when I add another trigger behind the door that is supposed to close it and type the code for it it won’t compile or even open in Unreal Engine anymore.

I have tried: rewriting the code, restarting my pc, repairing/reinstalling both Visual Studio and Unreal Engine, mess around with NMake paths (not sure what I did anymore its been a week+ of trying whatever I could. I would appreciate every info, or advice on what to include here to make it easier for you to see whats wrong.
My code: .[h][1] [cpp][2]

VS build output: [BuiltOutput][3]

Error screenshot:

My VS version: 15.4.3

Please help and thanks for your time

your close door method is incorrect.

First you have written it as: “void UCloseDoor ()” which is also misleading with the c’tor - but VS seems to overcome this.

change your line 28 in CPP to this one.

void UCloseDoor::CloseDoor()
{
//...
}

Advice for future - Pick a better Class and Method names!

Hey there Lobotomiac,

From the log looks like it’s a very simple issue to solve, but I wanted to point out a few tips before giving you the answer:

  • Do not even waste your time looking at the Error Output window, close that because it’s not going to help you when using Unreal, instead keep using the output log just like you did right there.
  • Try to assign nullptr instead of the NULL macro, it just sticks to the UE4 coding standard
  • Keep a close look at the error code, you can easily find the issue if you read closely

Now the issue is on CloseDoor.cpp(31): error C3861: 'GetOwner': identifier not found.

Looks like you are trying to access GetOwner from the Pawn/Character? (just my guess because the issue is on the .cpp not on the header). What comes to my head is that you are not including the header file from the Pawn you are calling this function on thus the compiler doesn’t know anyhing about a GetOwner().

If you ever need more help I’ll drop you a link to an useful discord chat with a community of devs that can help you with these issues as well: http://unrealslackers.org/

Hope this helps!

No, just look at line 28 in C++

and you will immediately see whats wrong.

The identifier not found - because on line 28 there is a function declared - and not an implementation of the desired method.

The function has nothing to do with class methods, it is just a plain C function.
So GetOwner is not related to the AActorComponent and thus undefined.

oh I didn’t notice he shared the .cpp

‘+1’ with remark “nullptr is a C++ coding standards while NULL is visual studio only :)”.

Thanks people! Good advice and I will. Thank you so much once again!

Thanks a million!

Thanks! looks like I have a lot to learn!

When speaking about C++ every one has a lot to learn - Sometimes it feels that Bjarne is the only one who knows what is going on there.