If I have any weird engine compile errors like this I always do the following:
Delete everything, that is not absolutely necessary to compile the game:
- Binaries
- DerivedDataCache
- Intermediate
- Saved
- In root folder YourGameName.sln
Then keep both editors, unreal and visual studio closed. Go to the file explorer, select your YourGameName.uproject file and klick ‘Generate Visual Studio Files’. That takes a small bit of time, depending on your hardware.
After that you can open the .sln and hit Build. Make sure
- Build Configuration is ‘Development Editor’
- Startup Project is Games->YourGameName.
- In error List in VS choose ‘Build Only’. For Unreal Intellisense feels a bit wonky.
To really get C++ up and running I also needed to
-
install the unreal integration
-
some more C++ Packages (VS wont stop screaming after you have)
-
disable ‘Live Coding’ in Unreal
-
fix 2 compile errors from code that was shipped (really easy ones, vs opens the line if you double klick the error in the error list)
I also always compile the code with the engine closed and only open the engine editor with the ‘Local Windows Debugger’ in VS.
Hope that helps