1

I have been trying to get started with Boost development on my Macbook, which has MacOS Catalina(OSX 10.15). The following is the link to the file, example.cpp on the Boost Getting Started on Unix Variants page:

Link: https://www.boost.org/doc/libs/1_71_0/more/getting_started/unix-variants.html#boost-root-directory

I'll also provide the code directly here:

#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>

int main()
{
    using namespace boost::lambda;
    typedef std::istream_iterator<int> in;

    std::for_each(
        in(std::cin), in(), std::cout << (_1 * 3) << " " );
}

On compiling this on terminal, I get the following errors:

In file included from example1.cpp:1:
In file included from /Users/sharvankumar/boost_1_71_0/boost/lambda/lambda.hpp:23:
In file included from /Users/sharvankumar/boost_1_71_0/boost/lambda/detail/operator_return_type_traits.hpp:24:
In file included from /Users/sharvankumar/boost_1_71_0/boost/detail/container_fwd.hpp:98:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/complex:246:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:313:9: error: 
      no member named 'signbit' in the global namespace
using ::signbit;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:314:9: error: 
      no member named 'fpclassify' in the global namespace
using ::fpclassify;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:315:9: error: 
      no member named 'isfinite' in the global namespace; did you mean 'finite'?
using ::isfinite;
      ~~^
/usr/local/include/math.h:749:12: note: 'finite' declared here
extern int finite(double)
           ^
In file included from example1.cpp:1:
In file included from /Users/sharvankumar/boost_1_71_0/boost/lambda/lambda.hpp:23:
In file included from /Users/sharvankumar/boost_1_71_0/boost/lambda/detail/operator_return_type_traits.hpp:24:
In file included from /Users/sharvankumar/boost_1_71_0/boost/detail/container_fwd.hpp:98:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/complex:246:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:316:9: error: 
      no member named 'isinf' in the global namespace
using ::isinf;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:317:9: error: 
      no member named 'isnan' in the global namespace
using ::isnan;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:318:9: error: 
      no member named 'isnormal' in the global namespace
using ::isnormal;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:319:7: error: 
      no member named 'isgreater' in the global namespace; did you mean '::std::greater'?
using ::isgreater;
      ^~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:720:29: note: 
      '::std::greater' declared here
struct _LIBCPP_TEMPLATE_VIS greater : binary_function<_Tp, _Tp, bool>
                            ^
In file included from example1.cpp:1:
In file included from /Users/sharvankumar/boost_1_71_0/boost/lambda/lambda.hpp:23:
In file included from /Users/sharvankumar/boost_1_71_0/boost/lambda/detail/operator_return_type_traits.hpp:24:
In file included from /Users/sharvankumar/boost_1_71_0/boost/detail/container_fwd.hpp:98:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/complex:246:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:320:7: error: 
      no member named 'isgreaterequal' in the global namespace; did you mean '::std::greater_equal'?
using ::isgreaterequal;
      ^~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:749:29: note: 
      '::std::greater_equal' declared here
struct _LIBCPP_TEMPLATE_VIS greater_equal : binary_function<_Tp, _Tp, bool>
                            ^
In file included from example1.cpp:1:
In file included from /Users/sharvankumar/boost_1_71_0/boost/lambda/lambda.hpp:23:
In file included from /Users/sharvankumar/boost_1_71_0/boost/lambda/detail/operator_return_type_traits.hpp:24:
In file included from /Users/sharvankumar/boost_1_71_0/boost/detail/container_fwd.hpp:98:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/complex:246:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:321:9: error: 
      no member named 'isless' in the global namespace
using ::isless;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:322:9: error: 
      no member named 'islessequal' in the global namespace
using ::islessequal;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:323:9: error: 
      no member named 'islessgreater' in the global namespace
using ::islessgreater;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:324:9: error: 
      no member named 'isunordered' in the global namespace
using ::isunordered;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:325:9: error: 
      no member named 'isunordered' in the global namespace
using ::isunordered;
      ~~^
13 errors generated.

Now after a lot of Googling, reading posts on StackOverflow, and on the Apple Developers Forum, I came to the conclusion that there is some problem with the cmath and math.h header files in Xcode, which is causing this problem. Up to OSX 10.14, there was a fix for this, which was to install the package macOS_SDK_headers_for_macOS_10.14.pkg, which would install the required headers in the base system. But from Catalina onwards, they've removed this package.

Now, until Apple provides a workaround for this, I was wondering if I could get any help that is Boost specific? The only other option is to downgrade my MacOS version, but I'm looking for an easier option. Any help is appreciated.

0 Answers0