Cannot compile a project with name starting with numbers

I wasted a few hours because of this…

How to reproduce:

  1. Create a c++ project using UE4. e.g. MyProject
  2. Close the project
  3. Rename the project to something like 1MyProject
  4. Generate visual studio project files
  5. Open .sln file and try to build.

You get errors saying
“expected an identifier” in these lines:

#define 1MyProject_Source_MyProject_MyProjectGameModeBase_h_14_RPC_WRAPPERS....
:

Obviously, #define fails because #define cannot define when the argument starts with a number.