Issue with include files for unreal basic types

Hey there,

I’m struggeling with includes. I have code that was working 4hours ago and now it is not… telling me types are unknown.
Here is the code (whole file).


#pragma once


class FDirectoryFileCounter : public IPlatformFile::FDirectoryVisitor
{
    uint64 numFiles = 0 ;
    uint64 numDirs = 0;
public:

    virtual bool Visit(const TCHAR* FilenameOrDirectory, bool bIsDirectory)
    {
        if (bIsDirectory)
        {
            ++numDirs;
        }
        else
        {
            ++numFiles;
        }
        return true;
    }

    uint64 GetNumFiles() { return numFiles; }
    uint64 GetNumDirs() { return numDirs; }
};

This was working, as the types IPlatformFile::FDirectoryVisitor should be included through the basic includes of the engine, done via the build.cs file.?
There is the build.cs


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

using UnrealBuildTool;

public class SteamWorkshop: ModuleRules
{
    public SteamWorkshop(ReadOnlyTargetRules Target) : base(Target)
    {
        PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;

        PublicIncludePaths.AddRange(
            new string] {
                "SteamWorkshop/Public"
                // ... add public include paths required here ...
            }
            );


        PrivateIncludePaths.AddRange(
            new string] {
                "SteamWorkshop/Private",
                // ... add other private include paths required here ...
            }
            );


        PublicDependencyModuleNames.AddRange(
            new string]
            {
                "Core",
                "OnlineSubsystem",
                "OnlineSubsystemUtils",
                "OnlineSubsystemSteam",
                "SteamworksCustom",
                // ... add other public dependencies that you statically link with here ...
            }
            );


        PrivateDependencyModuleNames.AddRange(
            new string]
            {
                "CoreUObject",
                "Engine",

        // ... add private dependencies that you statically link with here ...    
            }
            );


        DynamicallyLoadedModuleNames.AddRange(
            new string]
            {
                // ... add any modules that your module loads dynamically here ...
            }
            );
    }
}



As unreal has a pretty old implementation of Steam SDK, I’m forced to include the current Steam SDK version manually. So I made another module that has the SDK in it and changed the build.cs file to depend on SteamworksCustom instead of Steamworks. Now everything seems to go viral and I have no idea why. Why is it complaining on a file that has nothing to do with this, does not even depend on the steam stuff .

I tried to go back to the unreal Steam SDK (Steamworks module) but the include issue persists…

There are also other files that have issues with the basic types. What could have caused this? Already tried rebuilding, deleting intermediate files.

Build.cs just tells the compiler what directories to look in when searching for an include. You still have to include the file.

Thanks for your reply.
Thats the strange thing when working with Unreal. Sometimes you do need to include, sometimes not. As said. it WAS working without, for what ever reason…

The reason why that happens is because sometimes your file can be included in a unified header (ModuleNameXofY.cpp), which happens to have other classes that included the file you needed. However, if UHT detects changes in that file, it removes it from the unified header so your file gets compiled alone (and thus ends up missing includes).

Ah, didn’t know about that, thanks for the insight. Unfortunately, I’m not able to find any usefull information regarding unified headers, expect the term itself beeing used. Do you have any ressource that describes what those are and when they are put together?