Can't add classes to xcode project

Hi,

I’m new to unreal and xcode development.

I’m having trouble adding my classes to xcode project. I’m sure it’s something very simple but I can’t seem to find an answer.

I will list the steps below of what I’m doing.

  • Start Unreal with BasicCode C++ project using Epic Launcher.
  • I can see the default xcode projects and its classes in xcode.
  • Add my own classes called SomeClass.cpp, SomeClass.hpp by right clicking on the source folder and selecting “New Files…”. I can confirm that this creates the files in the directory but for some reason, xcode is not finding the files I added. You can see it in the attached screenshot.

  • Using the unreal “Add New” button in the content browser, I added another C++ class called SomeActor. It successfully added SomeActor.cpp, SomeActor.h and in the process, it also found the SomeClass.cpp, SomeClass.hpp that I added earlier. You can see that in the attached screen shot.

So it looks like the process of adding new class through unreal is some how refreshing and finding the class I added earlier but when I add some class strictly through xcode project, xcode project is not finding those files.

Do you know what’s happening please?

Thank you very much for your help,

Unreal builds the solution in a specific way, so if you add files through the IDE (be it XCode or VS), you can run into issues.

My personal workflow for adding items is to close the solution, create the files/folders, right click on the UPROJECT file, and then click on the Generate Solutions option, then re-open the solution in the IDE. Admittedly if you’re use to just adding a file at a time, it can seem a bit awkward - but it keeps things simple and UE happy.

Thank you for the answer! That makes a lot of sense. :slight_smile: One more thing, is right clicking to Generate Solutions VS thing? I right clicked on the uproject file but I don’t see any Generate Solutions option.

Thanks again for your help! :slight_smile:

It may be a windows thing more than a VS thing. :slight_smile: You can regenerate the solution through the Editor as well. Load up your Project in the editor and it should be under the File menu.

ah ok, thanks! I clicked on File->Refresh Xcode Project under File menu as you suggested and it worked!

thanks again, :slight_smile: