Re: Xcode vs. Boost
Re: Xcode vs. Boost
- Subject: Re: Xcode vs. Boost
- From: Andreas Grosam <email@hidden>
- Date: Mon, 06 May 2013 09:03:51 +0200
If you have a Foundation project that includes boost header, you need to ensure that for all translation units all boost headers will be included before any Foundation headers.
Foundation defines a few macros that clash with other names used in boost. For example, boost fusion defines class with name "nil" which conflicts with Objective-C macro nil.
You may achieve this prerequisite through putting all your boost headers before any Foundation header into a Prefix header, e.g.:
// YourProject-Prefix.pch
#ifdef __cplusplus
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/home/phoenix.hpp>
#include <boost/fusion/adapted.hpp>
#include <boost/fusion/algorithm.hpp>
#include <boost/fusion/container.hpp>
#include <boost/fusion/functional.hpp>
#include <boost/fusion/iterator.hpp>
#include <boost/fusion/mpl.hpp>
#include <boost/fusion/sequence.hpp>
#include <boost/fusion/support.hpp>
#include <boost/fusion/tuple.hpp>
#include <boost/fusion/view.hpp>
#endif
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif
BTW: you should use most recent boost, since there is a bug somewhere in the internals in spirit/fusion/phoenix - if I remember right until v1.51.0, which occurs when you use clang's standard lib. The fix is easy, but anyway v1.53 compiles without errors.
Andreas
On 05.05.2013, at 17:48, Michael McLaughlin wrote:
> I recently compiled an old project using Xcode 4.6.2 under OS 10.7.5. --> Everything OK.
>
> However, this tool contains
>
> #include "boost/math/special_functions.hpp"
>
> and I updated my Boost installation to 1_50_0 from 1_44_0. After the update, and after changing "search header paths" accordingly, I got 20 Clang errors, internal to Boost, starting in cons_fwd.hpp. See arrows below:
>
> #if !defined(BOOST_FUSION_CONS_FWD_HPP_INCLUDED)
> #define BOOST_FUSION_CONS_FWD_HPP_INCLUDED
>
> namespace boost { namespace fusion
> {
> struct nil; <-- Declaration of anonymous struct must be a definition
>
> template <typename Car, typename Cdr = nil> <-- Expected a type
> struct cons;
> }}
>
> #endif
>
> Xcode is behaving as though Boost itself were broken (which seems unlikely). Also, no variations on language or dialect seem to matter.
>
> Any thoughts? Workarounds?
>
> Thanks.
>
> --
> Michael McLaughlin
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden