Error when compiling/building for a non-server configuration (C4716: function must return a value)
chris-gong opened this issue · comments
The project compiles fine in Visual Studio for a server configuration, but these errors occur when trying to build the project for an editor/client configuration:
'AGameLiftTutorialGameMode::StopBackfillRequest': must return a value
'AGameLiftTutorialGameMode::CreateBackfillRequest': must return a value
This is only for the master branch and occurred when I added new methods in the GameLiftTutorialGameMode.cpp class, but didn't add return statements outside of the #if WITH_GAMELIFT and #endif compiler directives for a couple of new functions. The #if WITH_GAMELIFT directive only evaluates to true when the build target is of type server. However, the CreateBackfillRequest
and StopBackfillRequest
methods have non-void return types. Therefore, we need return statements outside of the compiler directives. Otherwise, when building for a non-server configuration, Visual Studio will think that the function has no return statement, which is syntactically incorrect for any function written in C++ that returns something.
This pr, #11, fixes this issue.