Fix running Editor or Game target with console on Windows

This commit is contained in:
Wojtek Figat
2026-03-06 11:11:45 +01:00
parent b8fcb51aa3
commit c0056f3d9d
3 changed files with 7 additions and 3 deletions

View File

@@ -41,7 +41,8 @@ public class Main : EngineModule
/*{
options.PrivateDefinitions.Add("USE_VS_MEM_LEAKS_CHECK");
}*/
if (options.LinkEnv.LinkAsConsoleProgram)
options.CompileEnv.PreprocessorDefinitions.Add("PLAIN_MAIN");
break;
case TargetPlatform.UWP:
options.SourcePaths.Add(Path.Combine(FolderPath, "UWP"));

View File

@@ -25,13 +25,13 @@ extern "C" {
__declspec(dllexport) int32 AmdPowerXpressRequestHighPerformance = 1;
}
#if FLAX_TESTS
#if PLAIN_MAIN
int main(int argc, char* argv[])
#else
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
#endif
{
#if FLAX_TESTS
#if PLAIN_MAIN
HINSTANCE hInstance = GetModuleHandle(NULL);
LPTSTR lpCmdLine = GetCommandLineW();
#endif

View File

@@ -44,6 +44,9 @@ public class FlaxEditor : EngineTarget
{
base.SetupTargetEnvironment(options);
// Uncomment to get console
//options.LinkEnv.LinkAsConsoleProgram = true;
// Setup output folder for Editor binaries
switch (options.Platform.Target)
{