diff --git a/cmake/Macros.cmake b/cmake/Macros.cmake index 4c3ed3428..0cf88266e 100644 --- a/cmake/Macros.cmake +++ b/cmake/Macros.cmake @@ -130,7 +130,7 @@ macro(sfml_add_example target) source_group("" FILES ${THIS_SOURCES}) # create the target - if(THIS_GUI_APP AND SFML_OS_WINDOWS) + if(THIS_GUI_APP AND SFML_OS_WINDOWS AND NOT DEFINED CMAKE_CONFIGURATION_TYPES AND ${CMAKE_BUILD_TYPE} STREQUAL "Release") add_executable(${target} WIN32 ${THIS_SOURCES}) target_link_libraries(${target} sfml-main) else() diff --git a/examples/win32/Win32.cpp b/examples/win32/Win32.cpp index 5df33a845..653ece7e2 100644 --- a/examples/win32/Win32.cpp +++ b/examples/win32/Win32.cpp @@ -47,8 +47,10 @@ LRESULT CALLBACK onEvent(HWND handle, UINT message, WPARAM wParam, LPARAM lParam /// \return Error code /// //////////////////////////////////////////////////////////// -INT WINAPI WinMain(HINSTANCE instance, HINSTANCE, LPSTR, INT) +int main() { + HINSTANCE instance = GetModuleHandle(NULL); + // Define a class for our main window WNDCLASS windowClass; windowClass.style = 0;