You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When compiled under MSVC, the code fails if windows.h is included.
That header defines a function DebugBreak() while CATCH checks for a macro with the same name.
On a related note, on MSVC, the intrinsic __debugbreak() should be preferred over DebugBreak() (the latter requires windows.h, and requires debug symbols or it'll break into the wrong stack frame)
Here's a quick MSVC DebugBreak() replacement I whipped up:
#if defined(_MSC_VER)
extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent();
#define DebugBreak() if (IsDebuggerPresent() ) { __debugbreak(); }
#endif
(Still kind of ugly to reuse the name DebugBreak though. Would be cleaner to rename it entirely to avoid conflicting with the windows.h one)
The text was updated successfully, but these errors were encountered:
Thanks for bringing this up.
Oddly I just started seeing this in the VS2010 solution I have running in my EC2 instance - but I haven't had any time where I have access to sufficient internet access to fix it :-(
I'll be trying to reproduce it in my VM on my laptop. Hope to have a fix shortly.
Should be fixed now. I used your suggestion more-or-less as-is. Thanks for that.
I also renamed the top level macro to avoid the name clash (which makes more sense now we're using __debugbreak() ).
When compiled under MSVC, the code fails if
windows.h
is included.That header defines a function
DebugBreak()
while CATCH checks for a macro with the same name.On a related note, on MSVC, the intrinsic
__debugbreak()
should be preferred overDebugBreak()
(the latter requires windows.h, and requires debug symbols or it'll break into the wrong stack frame)Here's a quick MSVC
DebugBreak()
replacement I whipped up:(Still kind of ugly to reuse the name
DebugBreak
though. Would be cleaner to rename it entirely to avoid conflicting with the windows.h one)The text was updated successfully, but these errors were encountered: