x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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 https://wiki.unrealengine.com/Steam_workshop 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?

Product Version: UE 4.18
Tags:
more ▼

asked Jun 27 '18 at 01:35 AM in C++ Programming

avatar image

HighlandScotch
23 1 3 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Jun 27 '18 at 11:42 PM

avatar image

HighlandScotch
23 1 3 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question