Xcode vs. Boost

  • 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
  • On May 5, 2013, at 10:48 AM, Michael McLaughlin wrote:

    > 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.

    Are you sure?  It's exceedingly suspicious that the problem involves the identifier "nil".  This definitely seems as though the code were being compiled as Objective-C++, not just C++.  In Objective-C++, "nil" is a reserved word.

    Regards,
    Ken
  • HI Michael.

    You are not telling us which compiler (frontend) and stdlib you are/have been using.
    Additionally, 1.50.0 is no longer current as you probably know. SInce Clang is not a primary test compiler for Boost, I could easily imagine problems, as C++11-implemenation have been a moving target for both Clang/libc++ and Boost. In fact, according to the 1.53.0 release notes Boost is tested against "Clang from Subversion".

    Mikkel

    On 5 May 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      (<Xcode-users...>)
    > Help/Unsubscribe/Update your Subscription:
    > https://lists.apple.com/mailman/options/xcode-users/<my.inputstream...>
    mail.com

    >
    > This email sent to <my.inputstream...>
  • Hello,

    The compiler was evidently the problem.  I switched to LLVM GCC 4.2 and the compilation was successful with Boost 1.50 (haven't tried 1.53).  This is just for C++, not Objective-C++ and the language is set to GNU99.

    On May 5, 2013, at 12:27 PM, Mikkel Islay wrote:

    > HI Michael.
    >
    > You are not telling us which compiler (frontend) and stdlib you are/have been using.
    > Additionally, 1.50.0 is no longer current as you probably know. SInce Clang is not a primary test compiler for Boost, I could easily imagine problems, as C++11-implemenation have been a moving target for both Clang/libc++ and Boost. In fact, according to the 1.53.0 release notes Boost is tested against "Clang from Subversion".
    >
    > Mikkel
    >
    >
    > On 5 May 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      (<Xcode-users...>)
    >> Help/Unsubscribe/Update your Subscription:
    >> https://lists.apple.com/mailman/options/xcode-users/<my.inputstream...>
    mail.com

    >>
    >> This email sent to <my.inputstream...>
    >

    --
    Michael McLaughlin
    <mmclaughlin1...>
  • 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      (<Xcode-users...>)
    > Help/Unsubscribe/Update your Subscription:
    > https://lists.apple.com/mailman/options/xcode-users/<agrosam...>
    >
    > This email sent to <agrosam...>
previous month may 2013 next month
MTWTFSS
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
Go to today