Download

generated.h file for new custom module is missing

In UE4.20 I have created a new plugin via the editor’s plugin window. Then I added a new class to that plugin via the “Create C++ class” menu item. However, after a full rebuild of the project in Visual Studio 2017 now the generated.h file of the plugin is missing, so the project cannot be compiled. I tried to delete the Intermediate, Build, Saved, .vs folders, both for the project and the module, I deleted the .sln file and regenerated the VS project via context menu of the .uproject file.

However, nothing of this worked, the generated.h file is still missing.
Any odther ideas?

I’ve had all kinds of problems when working with plugin c++ or regular classes for that matter. First are your source files/directories is the normal directory structure? If they are for me I usually close the project in Editor, clean command in visual studio, close visual studio and reopen project. It seems to scan the folders, add the needed generated headers etc and fix the solution file.

Assuming you right-clicked .uproject and “Generate Project Files”? This is what generates the generated.h.

(Make sure no errors are occuring during this - it is hard to see the output in the window. Sometimes you have to execute the command from a terminal to see output)

Yes, this is exactly what I am doing. But I am not sure whether an error occurs, the window disappears immediately.
What is the command to regenerate project files from the command line?

Not sure - seems to change over time… struggled with it a couple times in the past

I think:
“$EngineRoute”\UE_4.X\Engine\Binaries\DotNET\UnrealBuiltTool.exe -projectfiles -project="$AbsoluteProjectRoute" -game -rocket -progress"$EngineRoute"\UE_4.X\Engine\Binaries\DotNET\UnrealBuiltTool.exe -projectfiles -project="$AbsoluteProjectRoute" -game -rocket -progress

taken from
https://answers.unrealengine.com/questions/14280/generate-vs-project-files-by-command-line.html

Ok, I ran UBT from the command line and got the following output:


S:\Programs\Epic Games\UE_4.20\Engine\Binaries\DotNET>UnrealBuildTool.exe  -projectfiles -project="M:/Games/Tycoon/Tycoon.uproject" -game -rocket -progress
Discovering modules, targets and source code for project...
@progress 'Binding IntelliSense data...' 0%
S:\Programs\Epic Games\UE_4.20\Engine\Source\ThirdParty\Expat\Expat.Build.cs: warning: Referenced directory 'S:\Programs\Epic Games\UE_4.20\Engine\Source\ThirdParty\Expat\expat-2.2.0\Win64\VS2015\Release' does not exist.
@progress 'Binding IntelliSense data...' 50%
@progress 'Binding IntelliSense data...' 100%
@progress 'Writing project files...' 0%
@progress 'Writing project files...' 33%
@progress 'Writing project files...' 67%
@progress 'Writing project files...' 100%

However, still no generated.h file. I noticed now that no such generated header file is created for the whole project at all, i.e. not only those for the module are missing :frowning:

what is the error when you compile from Visual Studio?

Ok guys, I found the error: In one of the header files within the custom plugin there was fhe following piece of code:


#pragma once

#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "Mapper.generated.h"

class MappingHelper   // HERE IS THE PRBOBLEM THE ; WAS MISSING !!

UCLASS()
class MAPPING_SYSTEM_API Mapper : public UObject
{
    GENERATED_BODY()
    /// and some more stuff ...
};

So all that was missing is the semicolon ; in the line “class MappingHelper”. Probably because it interferred with the UCLASS() macro in the next line …

Anyways, problem was a bug in my own code :slight_smile:
Thanks for your help everyone!