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

我的未来我决定 提交于 2019-12-04 10:45:13

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.

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

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.

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

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