Strange compile errors after upgrading project to 4.8

I’ve just upgraded my project from 4.7 to 4.8. I get these strange errors:

GetActorLabel() is not a member of AActor

This happens in any class that derives from AActor. Intellisense says that function exists though.

MyEditorVariable is not a member of MyClass

This error occurs in .generated.h files. I have classes implementing PostEditChangeProperty(). From what I’ve seen in the docs, it should be wrapped inside #if WITH_EDITOR ... #endif in the .cpp, so I’ve wrapped its declaration in the .h file in that preprocessor directive also. I’ve also got some variables that are for use in the editor only, so they’re also wrapped inside.

Of course, if I comment out the if statement or bring my variables out of it that error will no longer occur, but then it defeats the point.

It is difficult to say for sure without more code, but I think what is happening is you are wrapping a UPROPERTY variable with #if WITH_EDITOR.

The UBT doesn’t support preprocessor directives so the generated.h file will still include those variables, which now don’t exist. Unfortunately, this “fix” is removing the WITH_EDITOR directive on the variables, but leave it on the function.

Still not sure what’s up with those errors but apparently there were way more than I thought. Had to revert to a backup project. Here’s the solution that kind of magically fixed everything for me:

Instead of right clicking the .uproject file and selecting switch version (which is what I did to upgrade the first time around), I ran the launcher and had the new engine’s project browser open a copy of the old project. This took a lot longer to upgrade, but the thing is–everything worked perfectly (and strangely enough, even code that error’d out as deprecated when actually compiling in VS).

Has this lack of support always been a thing? It worked completely fine in 4.7–and in my answer below, it actually still appears to work fine here in 4.8.