Problems when adding class from VisualStudio

Hi guys,

I’m facing problems whenever i add classes in Visual Studio and not from the Editor. I’ve seen other Questions but none seem to have an answer to my problem.

  1. I add a AA.cpp and AA.h empy files on the following folder: My_Project/Source/My_Project

2)Exit VS and generate VS Files through right clikcing on .uproject.

3)Re-open VS and my recently added files are not included as part of the solution, they are erased from the solution but remain on disk.

4)I right click and add these files again as existing items.

5)I add a #include AA.h in another .cpp file but compilation fails as it simply can’t find the header file AA.h.

Any insights of this problem?

I know you’ve already said as much, but I just want to double check.

The new files are definitely going into the Source folder and not the Intermediate folder? (by default VS will try and put them inside Intermediate, which won’t work with UBT).

Hi Jamie. Yes, already checked that as i’ve read that is a common mistake.

Thing is that i can’t seem to add a class from the Editor that doesn’t have a parent - child relation with UObject.

What if you add the AA class from within the Unreal Engine editor’s Add Code menu?

Sounds like you put them into subfolder of My_Project, you’ll have to add these folders in your Build.cs.

PrivateIncludePaths.AddRange(new string[] { "My_Project/Subfolder" } );

Yeah, you can’t do that in 4.2, but you will be able to in 4.3 :slight_smile: