Download

Problem with files added outside the editor

Hi :slight_smile:

I have a problem with files added outside the editor to my VS project. I’ve added to files MainMenuWidget.h and MainMenuWidget.cpp that contain code of my menu widget. But after adding them(Through Visual Studio File -> New File) to my project I can’t normally build it. It gives me the following error:



EXEC : error : The first include statement in source file 'C:\**\Unreal Projects\TowerDefense\Source\TowerDefense\GameModes\Menu\MainMenuWidget.cpp' is trying to include the file 'TowerDefense.h' as the precompiled header for module 'TowerDefense', but that file could not be located in any of the module's include search paths.


I’ve tried rebuilding project files, but this doesn’t help.

It only builds when I rebuild a whole project. Why is that so? What is the proper way to add new source files to project, since I’m probably doing something wrong. :smiley:

Thanks in advance. :slight_smile:

There is no “Right” way just yet, but the way I’ve done it since the beginning is to create them on the file system. File > New File and Right Click on Project > Add Class create the file in the intermediate directory, due to that being the location of the project file itself, so thats always been something of a pet peeve and all around frustrating when trying to move quickly through class creation.

I use sublime text, create the files I want in the Source/MyProject/ folder per my teams directory specifications and regenerate the solution afterwards. This has taken a lot of the frustration out of the process.