I have been creating .cpp’s and .h’s from inside Visual Studios 2013, but the game compiles like those files don’t exist. Giving me errors like ‘cannot find header’. So I regenerate the Visual Studio files and all of my code is gone. Even the folders that I made to organize the project didn’t remain.
Can someone explain to me why this happens and how to stop it from happening?
Hi, can you tell us where you are creating the files on disk?
By default the Add New Item dialog in Visual Studio puts files in the project directory, which will actually be in the intermediate folder (Engine/Intermediate/ProjectFiles). This path is not parsed by the Unreal Build Tool which would explain why your code is being removed from the projects, and is not being built.
If you haven’t cleaned the solution your source and header files should still exist in that folder should you wish to recover them and put them in your actual Game source directory.
Yeah, the files were being created in the Intermediate folder.
Thanks for the help! I’ll create all my files in the Source folder next time
I would also recommend putting them within the Source/ProjectName directory with the other .cpp/.h so that when you are including them, you don’t have to put the path name with “…/headerfile”. Not that it’s a huge inconvenience, just something to keep in mind.