UHT Preprocessor not taken into account

Hi,

We are building our project in “Development” configuration and some preprocessor are not taken into account properly.

if you set in the MyPlayerController.h

#if WITH_EDITOR
public:
	/** Get all the objects that need Light rebuild */
	UFUNCTION(exec)
		void GetAllObjectsNeedLightRebuild();
#endif

And in the MyPlayerController.cpp

#if WITH_EDITOR
void AMyPlayerController::GetAllObjectsNeedLightRebuild()
{
	//Do someStuff
	
}
#endif

you will get this error:

error : no member named ‘GetAllObjectsNeedLightRebuild’ in ‘AMyPlayerController’; did you mean ‘execGetAllObjectsNeedLightRebuild’?

Following the error, it means that the Preprocessor is not taken into account in the header file and a Thunk for the exec has been create by UHT/UBT.

Could you please confirm that you can repro this on your side?

Thanks,

Hi,

The build issue is in “Development” configuration and not “Development Editor”.
In Development Editor, everything is fine as the preprossor is true.

Could you please confirm that you set the Configuration in VS on Development?

in case it’s important the issue raised during a Linux build. I didn’t test on windows yet, but UHT should be the same.

Hello ,

I haven’t been able to reproduce this compile error that you’re getting, but if I use the exact code you posted, I’m able to compile and the function shows up in the editor while in PIE. However, the log says that the command is not recognized. Is there anything else that you’re doing that could be causing the compile error to appear?

That would be the reason. I apologize for not reading more thoroughly. This is definitely an issue and I’ll be testing it on our latest internal build and submitting a bug if it still occurs.

The issue is caused by how UHT is generating the code for the console command part of the exec specifier as you mentioned. You can see the code itself that causes this in the .generated.h file for the class. Thank you for reporting this and I’ll let you know as soon as I’ve placed the bug in.

Hello ,

Thank you again for letting us know about this issue. I’ve placed a bug report in our database. For your reference, the bug number is UE-20145.

Have a nice day!

Unfortunately it most likely won’t be in prior to 4.10 but when the issue is fixed, I can give you the commit which will allow you to fix it in a source-built version of the engine if you wish.

Great Thanks.
Do you think it can make it in 4.9?

Thanks for the answer. I post it in the 4.9 forum just in case it can get some attention and maybe make the cut.

Yes if you can post the fix once it’s there I will apreciate.

hi any news on this issue?
Thanks,

Hello ,

Unfortunately there hasn’t been any progress made on this bug at this time. The only thing that I can confirm is that it is still in the list of bugs ‘to fix’ in future versions of the engine. Thank you for your patience thus far.