From 3c4ddbab17e1c3a95f3a9e0e931a0f687e601a96 Mon Sep 17 00:00:00 2001 From: arm32x Date: Wed, 4 May 2022 13:10:13 -0400 Subject: [PATCH] Fix Main.cpp template for -static -debug builds When building a Lime application in debug mode on Windows, the console subsystem is used and Windows looks for a 'main' function. However, the Main.cpp file used when linking statically always defines a 'WinMain' function regardless of whether the application is being built in debug mode. This commit adds an additional check in the Main.cpp that defines a 'main' function instead of 'WinMain' when building in debug mode. --- templates/cpp/static/Main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/cpp/static/Main.cpp b/templates/cpp/static/Main.cpp index dc71655b3..290d63baa 100644 --- a/templates/cpp/static/Main.cpp +++ b/templates/cpp/static/Main.cpp @@ -1,6 +1,6 @@ #include -#ifdef HX_WINDOWS +#if defined(HX_WINDOWS) && !defined(HXCPP_DEBUG) #include #endif @@ -14,7 +14,7 @@ extern "C" int lime_openal_register_prims (); extern "C" int ::nameSafe::_register_prims ();::end::::end:: -#ifdef HX_WINDOWS +#if defined(HX_WINDOWS) && !defined(HXCPP_DEBUG) int __stdcall WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { #else extern "C" int main(int argc, char *argv[]) { @@ -40,4 +40,4 @@ extern "C" int main(int argc, char *argv[]) { return 0; -} \ No newline at end of file +}