Extra Issue with Unreal 4.16+ & VS2017 not mentioned in video update

Like the title said, this is about an additional issue with Unreal 4.16 and the IWYU framework in Visual Studio 2017. Just to quickly summarize, you need to add a new #include in your .cpp file for each type of GameFramework Object that you need to use. One of the most common one that we’ll be adding is the Actor.h file. That was all stated in the update video.

Where the issue comes from is if you rely on the autocomplete portion. As your typing your new include line, if you autocomplete GameFramework, it’ll also include a backslash. Finishing the line, it’ll look like this:

#include "GameFramework\Actor.h"

This will cause an error when you try to compile in Unreal, but it doesn’t in VS.
To fix the error, it must be a forward slash, like so:

#include "GameFramework/Actor.h"

This second line will compile in both VS and Unreal.

2 Likes

So Far the ones I’ve found while taking the course:


In Section 3 Lesson 69:

When adding the Pressure Plate trigger you must add to the .h of the script

#include "Engine/TriggerVolume.h" 

To be able to use the ATriggerVolume. Also it must be placed before the #include “OpenDoor.generated.h” header or it will throw an error.


In Section 3 Lesson 70:
To be able to complete the PlayerController you will need to add the following header files while compiling the CPP

#include "Engine/World.h"
#include "GameFramework/PlayerController.h"

Additionally you need to validate that the pressure plate loads otherwise it will crash(I have my own Variables so edit as needed)

     if(pressurePlate)
     	{
    		if(pressurePlate->IsOverlappingActor(objectThatOpens)
    		{
    			openDoor();
   		}
   	}

Section 3 Lesson 77

To be able to use the DrawDebugLine () user must add the “DrawDebugHelpers.h” header file

#include "DrawDebugHelpers.h"

Section 3 Lesson 82

Header file needed to be add to use UPhysicsHandleComponent

#include "PhysicsEngine/PhysicsHandleComponent.h"

I will try to keep updating this as I find more issues

1 Like

I’m having massive problems with this.
Without adding #include “GameFramework\Actor.h” , it seems fine (but GetOwner isn’t doing as expected - as described) - but I have no errors:

But as soon as I add that include - errors everywhere…:

(hope you can see those screenshots - first time using Jing!

The errors are caused by the placement of the #include - any #includes with “generated” in the name need to be last in the list. I’ve found that when VS errors are unintelligible, compiling with the button in Unreal can sometimes give you more helpful messages; I had this same error and it actually told me exactly what the problem was.

1 Like

Thanks proto, that helped… Its been really weird. I did what you suggested - but Visual Studio still had lots of squiggies and errors - but it built cleanly… The squigglies didn’t go away - so I tried changing the direction of the slash as mentioned earlier - which gave build errors.

But when I changed it back, and re-built it - it was all good. Visual Studio seemed to be behaving (no squigglies) and it was correctly listing the methods for GetOwner.

How odd.

Thank you for this answer, I was having a similar problem to Brian with VS showing errors with when including GameFramework/Actor.h, placing the line earlier in the list in the header file seems to have cleared all errors and the code compiles in both VS and UE, and I can now access the AutoCompletes for GetOwner.
Thanks also to @binksayres for the initial post!

I wanted to add one additional thing to this. Due to the backslash issue, you can set Visual Studio to default to Forward Slash in the #include autocomplete. The image is for Visual Studio 2017, but this option is found in previous versions of Visual Studio as well. The page I found this at is:

Note, the Options dialog is found under the Tools pull down menu. And the image of the setting is here:

Privacy & Terms