Properly Removing C++ File References from Project Editor

Removing the code from the visual studio is simple enough (since you only need to delete the .h and .cpp files) but the annoyance is that these files are still visible from within the UE4 editor despite the fact they no longer exist. Right clicking on the Uproject file and generating project files does not resolve this issue, nor does building the project clear the files that are no longer there from my list of C++ classes.

How do I actually remove these files from the editor?

Just to be clear, did you delete the files from disk or just via Visual Studio?

You need to delete them from disk as well. Removing via VS does not actually delete the files, so Unreal build tool still picks them up.

I need this feature as well but I don’t want to continuously remove AND add files to the project all the time just to build WITH and WITHOUT the editor ! More details here How to exclude files from being compiled ? - C++ - Epic Developer Community Forums

I’ve deleted the files from disk. This is about Unreal Editor not properly cleaning up references to CPP / Header files that no longer exist.

Deleting the binaries for the project works, but it’s a messy solution to a problem that should be solvable by other means.

how does one even delete the binaries from the project? I first selected the .h and .cpp files from within VS and then I right clicked and selected remove. Then I opened explorer and deleted the files from the disk. When I try to compile it’s clearly referencing those files even though no other header or implementation file does. They were an extended class, nothing references them (except UE4 somehow).

So how did you go about deleting the binary files and does this resolve that conflict?

  1. You navigate (via Windows Explorer) to

…/YourGame/Binaries/Win64

and just outright delete all the files in there.

  1. Try to build your project now, and if it’s still busted, go to step 3)

  2. You navigate (via Windows Explorer) to

…/YourGame/

Make sure Visual Studio is closed, and

NB! Make sure you DON’T delete YourGame.uproject!

3.1) Delete the folder called “Intermediate”.

3.2) Delete the file “YourGame.sdf”

3.3) Delete the file “YourGame.sln”

3.4) Delete the file “YourGame.v12.suo”

  1. Now right-click “YourGame.uproject” → Generate Visual Studio Files.

  2. Open up “YourGame.sln”, select YourGame and build.