Including steam_api.h causes errors

I am using version 4.18 and adding Steam DLC checks in a C++ UserWidget child class (named WG_Steam_Menu). I am referencing A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums and when I add the include to the built-in Steam API:

#include "ThirdParty/Steamworks/Steamv139/sdk/public/steam/steam_api.h"

I get syntax errors related to my class which was previously building just fine:

Error C2059 syntax error: ‘,’ MyGame C:.…MyGame\WG_Steam_Menu.gen.cpp 49

Error C2143 syntax error: missing ‘;’ before ‘}’ C:.…MyGame\WG_Steam_Menu.gen.cpp 57

Error C2065 ‘ClassParams’: undeclared identifier C:.…MyGame\WG_Steam_Menu.gen.cpp 58

etc. My files look like:


**MyGame.Build.cs:**
using UnrealBuildTool;

public class MyGame : ModuleRules
{
	public MyGame(ReadOnlyTargetRules Target) : base(Target)
	{
		PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
	
		PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "Steamworks" });

		PrivateDependencyModuleNames.AddRange(new string[] {  });

		// Uncomment if you are using Slate UI
		// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
		
		// Uncomment if you are using online features
		PrivateDependencyModuleNames.Add("OnlineSubsystem");

        // To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
        DynamicallyLoadedModuleNames.Add("OnlineSubsystemSteam");
    }
}

**MyGame.uproject:**
{
	"FileVersion": 3,
	"EngineAssociation": "4.18",
	"Category": "",
	"Description": "",
	"Modules": [
		{
			"Name": "MyGame",
			"Type": "Runtime",
			"LoadingPhase": "Default",
			"AdditionalDependencies": [
				"UMG"
			]
		}
	],
	"Plugins": [
		{
			"Name": "OnlineSubsystemSteam",
			"Enabled": true
		}
	]
}

**WG_Steam_Menu.h:**
#pragma once

#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "ThirdParty/Steamworks/Steamv139/sdk/public/steam/steam_api.h"
#include "WG_Steam_Menu.generated.h"

/**
 * 
 */
UCLASS()
class MYGAME_API UWG_Steam_Menu : public UUserWidget
{
	GENERATED_BODY()
	
};

**WG_Steam_Menu.cpp:**
#include "WG_Steam_Menu.h"

These errors seem similar to strange errors I've seen in the past related to project file caching so I deleted all temporary files and re-generated the project files. However building the new project still throws the errors above. What is going on?

So this was another case of Visual Studio and Unreal getting confused by file changes. After completely deleting the project and re-cloning it from source control it built without errors.