Using boost from XCODE 4.6.1 - what are the proper build settings?
Asked Answered
S

4

5

I downloaded boost 1.53 and extracted to Users/user/Desktop/boost_1_53_0 I successfully built boost as static libraries following instructions at: http://libcinder.org/docs/v0.8.5/_cinder_boost.html

I changed XCODE's "Build Settings" "Header Search Paths" to /Users/user/Desktop/boost_1_53_0 as well as the "Library Search Paths" to Users/user/Desktop/boost_1_53_0/stage/lib

Then I build and get errors:

The first error I'm getting is "has_binary_operator.hpp" Parse issue Expected member name or ';' after declaration specifiers at the line:

template < typename Lhs, typename Rhs >

struct operator_exists {

...

Does anyone have tips for what the build settings should be? The project contains some files that are cocoa/objective C (.m) and others that are C++(.mm) using boost. I'm completely new to trying to use boost under OSX mountain lion and XCODE 4.6.1.

Stook answered 27/5, 2013 at 5:33 Comment(1)
Same error here.. boost 1.55, Xcode 5, all C++11 compilers + libraries in the project.Martellato
T
2

I'm a little late for this one, but in case anybody else has this issue...

I had this problem with boost in projects using Objective C. I would get parse and semantic issues in has_binary_operator.hpp and lexical_cast.hpp.

A quick fix was inserting "#undef check" before including boost headers in Objective C source files, as it would appear "check" is a reserved word in Objective C.

Tolbert answered 2/10, 2014 at 19:43 Comment(1)
this fixed this issue for me!Cesura
K
0

You can make sure to set compiler type is GNU98 or something like that, XCODE4 default compiler may be C++11 compliant

Karlakarlan answered 27/5, 2013 at 6:9 Comment(0)
B
0

I'm using boost from XCODE and I agree with fatih_k. I have all my c and c++ language settings set to GNU99 and GNU++98. I also have the 'compile sources as' option set to 'According to file type'.

I found that the projects I create always defaults to using Objective C, so maybe just go through your project setting and make sure you have everything configured for C++ and not Objective C.

I have not tried the C++11 options with boost yet.

Battaglia answered 27/5, 2013 at 6:34 Comment(2)
If I change the Compiler to LLVM GCC 4.2 I get fewer errors. They are still in has_binary_operator.hpp: Expected * before * Expected unqualified -id before 'do'Stook
I used macports to get boost. Where did you get yours?Battaglia
N
0

The Xcode 4.x default compiler is apple llvm, and it uses libc++ as default. You can change the settings in Xcode

To change the stdlib as libc++

a. Select the target from Xcode and go to the BuildSettings tab.

b. Go to Apple LLVM compiler 4.2 - Language option

Change the option as libstd from libc++

To change the compiler

a. Select the target from Xcode and go to the BuildSettings tab.

b. Go down Build options

Change the option C/C++/Objective C - Default option will be "Apple LLVM compiler 4.2" Change it to g++ 4.2

Newspaper answered 28/5, 2013 at 13:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.