Why am I getting C3668 error when compiling?

Hi guys,

1>D:/Prog/GitHub/UnrealEngine-4.1.0-release/Engine/Source/Runtime/Engine/Classes/GameFramework/Actor.h(1879): error C3668: ‘AActor::’ : method with override specifier ‘override’ did not override any base class methods

I have been getting this error when I try to compile my project. What I find odd is that when I Rebuild the UE4 project it compiles normally. But when I include some .h in my source files I get this error, even though I did not change UE code. I think I know what I should do to get it to work, the point is that I would not like to modify the engine code. I have downloaded the UnrealEngine-4.1.0-release.zip file and the Required_1of2.zip and Required_2of2.zip from the git current release page.

What I trying to do is to subclass a Engine.h class (FViewportClient.h). So I can add a viewport to my Slate window. This is my build file:

public class TestApp : ModuleRules
{
	public TestApp(TargetInfo Target)
	{
		PublicIncludePaths.Add("Runtime/Launch/Public");

		PrivateDependencyModuleNames.AddRange(
            new string[] { 
                "Core", 
                "CoreUObject",
                "Engine", 
                "Slate", 
                "StandaloneRenderer", 
                "Projects" });

		PrivateIncludePaths.Add("Runtime/Launch/Private");

        PrivateIncludePaths.AddRange(
            new string[] {
				"Programs/TestApp/Private",
			}
        );
	}
}

Have attached my source files.

EDIT:

Also, I dont understand why does the engine code gets recompiled at all. I am new to C++, but have a good background in C#. And since I dont change any line of code in UE4 folders, why does it gets recompiled?

Engine always get compiled with the project for some reason, so let him do that and next time it wont do that, also disable UE4 project building in solution settings so it wont compile engine twice. I don’t know why it happens but thats how UBT behaves

Was this ever solved? Encountering the same issue here.

Hi overlawled,

Could you post the full output that you receive when you try to build your project?

Hi.

Make sure that your function’s signature EXACLTY matches signature of function which you want to override.
In my case, it was parameter’s name that was the reason of C3668.

public override void SetupGlobalEnvironment()
AddCode: UEBuildConfiguration.bCompileAgainstEngine = true;
should sovle your compile error

Where to add this code exactly? I do see bunch of this functions but I’m not sure in which file to do it.