Failed to find object 'Class /Script/TPPGame.TPPPlayerController'

It happens when I recompile code inside editor. Nothing fancy here is code:
Header:

#include "TPPPlayerController.generated.h"

UCLASS(config=Game)
class ATPPPlayerController : public APlayerController
{
	GENERATED_UCLASS_BODY()
};

CPP:

#include "TPPGame.h"

ATPPPlayerController::ATPPPlayerController(const FPostConstructInitializeProperties& PCIP)
    : Super(PCIP)
{
	//PlayerCameraClass = ATPPPlayerCamera::StaticClass();
}

I haven’t initialized it in GameInfo constructor, as far as I know it shouldn’t have any effect on anything because is not used anywhere, or I’m wrong here ?
Striped down project is in attachment(there is all code, I revmoed all content and compiled binaries to reduce size) I have used TPP template to create it.

Also there is log from output in VS while rebuilding project:

1>------ Rebuild All started: Project: TPPGame, Configuration: Debug x64 ------
1>  Cleaning Rocket project.
1>  
1>  Unhandled Exception: System.IO.IOException: The directory is not empty.
1>  
1>     at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound)
1>     at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost)
1>     at Clean.Program.CleanRocketFiles(String GameName, String PlatformName, String ConfigName)
1>     at Clean.Program.Main(String[] Arguments)
1>  Generating code for TPPGame
1>  Module.TPPGame.cpp
1>  link.exe RocketEditor-TPPGame-Win64-Debug.dll
1>     Creating library E:\Unreal\TPPGame\Intermediate\BuildData\TPPGame\Win64\DebugGame\RocketEditor-TPPGame-Win64-Debug.lib and object E:\Unreal\TPPGame\Intermediate\BuildData\TPPGame\Win64\DebugGame\RocketEditor-TPPGame-Win64-Debug.exp
1>  -------- End Detailed Actions Stats -----------------------------------------------------------
1>  Copying Rocket build tools...
1>  Cumulative action seconds (4 processors): 0,00 building projects, 12,03 compiling, 0,00 creating app bundles, 0,00 generating debug info, 0,33 linking, 0,00 other
1>  UBT execution time: 16,88 seconds
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

Not sure if that have anything to do with it but this Exception looks suspicious.
link text

The clean exception is indeed troubling, though I suspect it is not causing the issue. I noticed that you are building in Debug configuration. If you hit the start button in visual studio everything should work correctly but if you want to use the debug version of your binaries from command line you will need to supply the -debug parameter. Does this issue reproduce for you in a Development build?

Thanks. It was indeed the issue. Building in development mode solved problem.

What is the difference between development mode and debug mode?

Also, where/how is my [class].generated.h file created?

When I go to create a new class, I create a .h and .cpp as instructed, but it’s not possible to navigate to the generated part of the code.

Alternatively, if I look at another class included with a tutorial (say, third person character), then I can navigate to the file “ThirdPersonCharacter.generated.h”.

Why is that? How is that file generated?

Development configuration is similar to the typical “Release” configuration where many optimizations are made but make the program harder to debug due to fewer debugging symbols. The generated.h file is created by UnrealHeaderTool during compilation. If you are curious about what was generated, these files can be found in [gamefolder]/Intermediate/BuildData/Include/[ModuleName]

Excellent answer, thank you.

Bob,

Is there anything I need to do to start the UnrealHeaderTool?

I’m making my ThirdPersonController .cpp and .h files, but when I write ThirdPersonController.generated.h at the top of my ThirdPersonController.h file, I get a red squiggly beneath #include, and it states “Error, cannot open source file”.

If I right click → open document on the generated.h file, I receive an error from VS stating that ThirdPersonController.generated.h is not found in the current source file’s directory or in build system paths.

So I’m confused when it comes to building new classes…

There is nothing you need to do to start UnrealHeaderTool other than compile. Does your code compile? The red squiggly is an indication that intellisense could not find the file and you may need to regenerate project files (via GenerateProjectFiles.bat) to freshen intellisense information.

To test things out, I started a new project, called MyProject, and it’s just the ThirdPerson template.

I can add my new controller class and header, and it compiles fine. When I try to add my controller to MyProjectGameInfo however, I get an error stating that AMyProjectController is not a class or namespace.

Here’s what my GameInfo class looks like:

// Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.

#include "MyProject.h"

AMyProjectGameInfo::AMyProjectGameInfo(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
{
	// Non-property initialization
	
	// Property initialization
	static ConstructorHelpers::FObjectFinder PlayerPawnOb(TEXT("Blueprint'/Game/MyCharacter.MyCharacter'"));
	if (PlayerPawnOb.Object != NULL)
	{
		DefaultPawnClass = (UClass*)PlayerPawnOb.Object->GeneratedClass;
	}
	 PlayerControllerClass = AMyProjectController::StaticClass();
}

I if I comment out PlayerControllerClass, all is fine.

So I took your advice and ran the batch for the header converter in this project, and it throws all kinds of errors and does not complete. (which is what I received last time as well) .

Now, when I go to build my project or debug, I get this:

Error 4 error CS0101: The namespace ‘’ already contains a definition for ‘MyProjectTarget’ c:\Users\dvoyle200\Documents\Visual Studio 2012\Projects\MyProject\Source - Copy\MyProject\MyProject.Target.cs 6 14 MyProject

Error 3 error CS0101: The namespace ‘’ already contains a definition for ‘MyProject’ c:\Users\dvoyle200\Documents\Visual Studio 2012\Projects\MyProject\Source - Copy\MyProject\MyProject.Build.cs 5 14 MyProject

What do I manage to keep doing wrong here?

I just created MyProject using ThirdPerson, added a header/cpp and assigned the PlayerControllerClass in my GameInfo and it compiled/ran fine. This is what my files look like:

MyProjectController.h (in MyProject/Source/MyProject/Classes)
// Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.

#include "MyProjectController.generated.h"

UCLASS()
class AMyProjectController : public APlayerController
{
	GENERATED_UCLASS_BODY()

};

MyProjectController.cpp (in MyProject/Source/MyProject/Private)
// Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.

#include "MyProject.h"

AMyProjectController::AMyProjectController(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
{
	// Non-property initialization
	// Property initialization
}

MyProjectGameInfo.cpp (in MyProject/Source/MyProject/Private)
// Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.

#include "MyProject.h"

AMyProjectGameInfo::AMyProjectGameInfo(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
{
	// Non-property initialization
	
	// Property initialization
	static ConstructorHelpers::FObjectFinder PlayerPawnOb(TEXT("Blueprint'/Game/MyCharacter.MyCharacter'"));
	if (PlayerPawnOb.Object != NULL)
	{
		DefaultPawnClass = (UClass*)PlayerPawnOb.Object->GeneratedClass;
	}

	PlayerControllerClass = AMyProjectController::StaticClass();
}

As for your GenerateProjectFiles.bat error. Looks like you copied the “Source” folder to “Source - Copy” and it is confusing UnrealBuildTool. Delete or move this copy to another folder that is not in your project folder.

Bob, thank you very much fro taking the time to look into this for me - I really appreciate it.

You’re right about copying that folder (I did that as backup, not realizing that the files would conflict).

I must be doing something wrong here. To start with a clean slate, I deleted my project, and started a new one from scratch.

I copy and pasted your code (which was identical to mine in all but one spot), and placed MyProhectController.h in Classes then MyProjectController.cpp in my private folder.

I’m getting the same errors when I try to build though.

error C2653: ‘AMyProjectController’ : is not a class or namespace name

At this point I have no idea, short of making a private youtube video and sharing it here, to try to troubleshoot the issue.

Couple things to check:

Does ProjectFolder/Intermediate/BuildData/Include/MyProject/MyProjectController.generated.h exist?

Does ProjectFolder/Intermediate/BuildData/Include/MyProject/MyProjectClasses.h contain a #include line for MyProjectController.generated.h?

If you say no to either of those that means UnrealHeaderTool did not process your file. Maybe it is in a location that you don’t have write access for some reason. Try making your project in C:\Projects\MyProject.

If you say yes to both then you may not be compiling the correct code somehow, since MyProject.h should be including MyProjectClasses.h, which includes MyProjectController.h, which contains the declaration for your class. Does every CPP file in your project include MyProject.h? Are you certain you are building the Development Win64 configuration?

It looks like the UnrealHeaderTool is not processing the file, as neither of those first options appear for me.

I’ve attached a screenshot to give a better idea of what it all looks like for me:

I’ve tried creating a new project at that location (C:/Projects/MyProject) and have the same result. I’m not sure what is going on here now.

I just noticed that the last image didn’t load, for whatever reason.

When you build, do you see a line in the build log that looks like this:

1> Generating code for MyProject

Try deleting your MyProject/Intermediate/BuildData folder and building again. This should refresh your generated includes

This what my build log looks like:

1>------ Build started: Project: MyProject, Configuration: Development x64 ------
1> Module.MyProject.cpp
1>C:\Projects\MyProject\Source\MyProject\Private\MyProjectGameInfo.cpp(16): error C2653: ‘AMyProjectController’ : is not a class or namespace name
1> -------- End Detailed Actions Stats -----------------------------------------------------------
1>ERROR : UBT error : Failed to produce item: C:\Projects\MyProject\Intermediate\BuildData\MyProject\Win64\Development\RocketEditor-MyProject.exp
1> Cumulative action seconds (8 processors): 0.00 building projects, 10.28 compiling, 0.00 creating app bundles, 0.00 generating debug info, 0.00 linking, 0.00 other
1> UBT execution time: 13.59 seconds
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command ““C:\Program Files\Rocket\Engine\Binaries\DotNET\RocketUnrealBuildTool.exe” MyProject Win64 Development -rocket=“C:\Projects\MyProject\MyProject.uproject”” exited with code 1.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

On the plus side, MyProjectController (both the header and .cpp) are appearing in intermediate/projectFiles

Do you mind zipping up your project and attaching it to a reply? I will inspect it to see if I can find what is wrong.

Sure thing

Link to Skydrive

Thank you again for being so through and patient with me!

MyProjectController.h/cpp are not in the Source folder. Move them from MyProject/Intermediate/ProjectFiles to MyProject/Source/MyProject/Classes/MyProjectController.h and MyProject/Source/MyProject/Private/MyProjectController.cpp