Developer Notes

This issue has been closed as 'Won't Fix' due to an extended period of time without updates. If this issue is important to you please let us know by posting on the AnswerHub or UDN, and Epic will re-open the ticket for further review.

Description

If a user declares a UFunction with the exec specifier, the UHT will add a call to that function so that it can be used as a console command in the editor. This becomes an issue when the declaration of that UFunction is part of a #if WITH_EDITOR block. When building in Development, the declaration will be skipped by the compiler but the function will still be called in the .generated.h.

Steps to Reproduce

1. Create a new blank C++ project
2. Add a new C++ class through the editor (File > New C++ Class...) and add an Actor called MyActor
3. After Visual Studio appears, in the MyActor.h add the following code:

 #if WITH_EDITOR
	UFUNCTION(exec)
		void TestFunction();
#endif 

4. At the top of Visual Studio, use the drop down to change the build configuration from Development Editor to Development.
5. Compile (ctrl+shift+b)
Result: The compile fails with a message mentioning that the function isn't part of AMyActor.
Expected: The UHT should ignore the declaration in the #if WITH_EDITOR to avoid causing compilation errors

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

1
Login to Vote

Won't Fix
ComponentUE - Foundation - Core
Affects Versions4.8.34.9
CreatedAug 19, 2015
ResolvedJan 17, 2017
UpdatedFeb 5, 2017
View Jira Issue