Skip to content

Commit 5646370

Browse files
committed
fix: fix include ordering in message_box in MSYS2
1 parent 81345e2 commit 5646370

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/helper/message_box.hpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,6 @@
1313

1414
namespace helper {
1515

16-
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || defined(__MINGW32__) \
17-
|| defined(__MINGW64__)
18-
// "WinUser.h" defines "#define MessageBox MessageBoxA"
19-
// which breaks this valid code, I love windows xD.
20-
#ifdef MessageBox
21-
#undef MessageBox
22-
#endif
23-
#endif
24-
25-
2616
struct MessageBox {
2717
enum class Type : u8 { Error, Warning, Information };
2818

@@ -36,4 +26,16 @@ namespace helper {
3626
};
3727

3828

29+
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || defined(__MINGW32__) \
30+
|| defined(__MINGW64__)
31+
// "WinUser.h" defines "#define MessageBox MessageBoxA"
32+
// which breaks this valid code, I love windows xD.
33+
#ifdef MessageBox
34+
#undef MessageBox
35+
#endif
36+
// this is to fix include order, if we include windows.h after this, it also works
37+
using MessageBoxA = MessageBox;
38+
#endif
39+
40+
3941
} // namespace helper

0 commit comments

Comments
 (0)