Just a few pointers

20 years ago I was really into C++, then C# came along and I have been focused on that since then and am a lot rusty…

Unity was ■■■■■■■ me off and I was staying away from Unreal because I knew how rusty those skills were. Eventually I decided to do it and have been learning for a few weeks using blueprints. I need to do something using C++, setup a C++ Actor and inherited a BP actor from that and made a property show up. First step. Now I need to open an XMLFile to pull some data.

#include “XmlFile.h”. Nope…

I know the header exists where the engine is installed however I just cannot figure out how to get the file to include! The docs just say header is XmlFile.h they don’t say if there is a directory structure needed or anything (or at least they don’t where they tell you about the library. I feel really stupid and old not being able to figure this out, but how unintuitive is this! Anyone that can point this idiot in the right direction?

Hey!

I found this answer from someone else, but it should still apply. This is how you usually add dependencies as well, so keep note.

So basically just find this line in your [ProjectName].Build.cs file (might be a little different this is my project):


PublicDependencyModuleNames.AddRange(new string] { "Core", "CoreUObject", "Engine", "InputCore", "OnlineSubsystem", "OnlineSubsystemUtils", "Steamworks", "Networking" });

and add the string “XmlParser”.

Then you should be able to do


#include "XmlParser.h"

in all of your other code files!

Hope this works,
Will

hi wnbaum,

Thank you so much, just did that and it runs fine. Intelisense in VS still sees the include as missing but it builds in VS and Unreal :slight_smile: Will have a play at opening my XML file after work :slight_smile:

Had a sneaky play in my lunch hour. It complies so it knows the header file is there but does not seem to see any of the libraries underneath it. There is also no intelisense in VS or anything else helpful :slight_smile: I am poking at whether VSCode might do a better job and also seeing if there is something else I need to go. Looking up PublicDependencyModuleNames.AddRange now to see if there is any advice around that …

And it is working. Needed to go to the file menu in my UE project and choose “Refresh visual studio project” :slight_smile: Good lesson.