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

徘徊边缘 提交于 2019-12-06 05:27:28

问题


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.


回答1:


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.




回答2:


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




回答3:


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.




回答4:


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



来源:https://stackoverflow.com/questions/16766843/using-boost-from-xcode-4-6-1-what-are-the-proper-build-settings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!