Boost logo

Geometry :

Subject: [ggl] Re: problems with Boost Geometry Xcode compile?
From: Mateusz Loskot (mateusz)
Date: 2010-03-10 13:02:34


Mark McCann wrote:
>
> The above does solve my problem for now. However, I'm still not sure
> exactly how this AssertMacros.h
> file is being included. Even if I move #include
> <boost/geometry/geometry.hpp> to the very first
> line of the file, the macro for "check" is still messing things up.
>

This macro is included *indirectly* by XCode public headers including
internal headers, and so on.
AFAIK, the AssertMacros.h comes from XNU sources [1], which is...Mac OS X
kernel, and even if you
don't want to use anything from XNU. It probably is dragged in by some
headers from C,
or C++ library or even from the abyss of POSIX layer provided by XCode
environment.

[1] http://mateusz.loskot.net/2010/03/10/cc-macros-made-by-apple/

Mark McCann wrote:
> This tells me that some header is automagically being included in all of
> my files.
>

That's exactly what happens and in fact this kind of issues are not
uncommon, especially when using
GCC which provides all-in-one implementation of various standards and
platform specifics.

Mark McCann wrote:
> This only happens in Xcode and only when I'm also using wxWidgets.

As I mentioned, it's XCode specific macro, so this problem happens on Mac OS
X/XCode.

Mark McCann wrote:
> However, I don't think it's an include from wxWidgets because of what
> I just mentioned. It is probable something in the compile environment
> needed for wxWidgets with Xcode.

Should be easy to confirm by compiling simple test:

#include <wx/wx.h>
#ifdef check
#error check defiend
#endif
int main() {}

For now, I'll have to use the #undef check trick before my Boost.Geometry
includes. Hopefully Apple will eventually stop using these stupid Macro
names!</code>

I'd not count on it, because this macro has been there for long time and I'd
not expect any fixes by
Apple there. If you search Apple developers mailing lists, you will notice
that common
recommendation to fix this problem is "rename your function to something
else"

Mark McCann wrote:
> Thanks for the support guys. Oh, I also agree that I would hesitate to
> change names just because some vendors use incredibly stupid/unfriendly
> macro names. But, you might
> have to weigh against how common of a problem this will be for people
> using Xcode.

As you may learn from the Boost #2115 bug report, there would be nearly 3000
places to fix in Boost :)

Mark McCann wrote:
> BTW, macros _are_ evil!

Yes, they are, but only if used by insane programmers naming them min, max,
check, etc.
If used by properly, they are helpful.

Best regards,

-----

-- 
Mateusz Loskot
http://mateusz.loskot.net
-- 
View this message in context: http://n3.nabble.com/problems-with-Boost-Geometry-Xcode-compile-tp437866p440239.html
Sent from the Boost Geometry mailing list archive at Nabble.com.

Geometry list run by mateusz at loskot.net