简体   繁体   English

Xcode 9 MacOS部署目标(使用C ++)给出错误

[英]Xcode 9 macos deployment target (with c++) giving error

When I try building a make project (from a c++ repository) I get the following error in XCode 9 : "MacBook Pro runs macOS 10.12.6, which is lower than program's minimum deployment target. Change your project's minimum deployment target or upgrade MacBook Pro's version of macOS." 当我尝试从c ++存储库构建一个make项目时,我在XCode 9中收到以下错误:“ MacBook Pro运行macOS 10.12.6,低于程序的最低部署目标。更改项目的最低部署目标或升级MacBook Pro。版本的macOS。”

I tried setting MAC_OS_DEPLOYMENT_TARGET and MAC_OSX_DEPLOYMENT_TARGET to no avail. 我尝试将MAC_OS_DEPLOYMENT_TARGET和MAC_OSX_DEPLOYMENT_TARGET设置为无效。

I really would appreciate any help as I'm banging my head against the wall trying to figure this out. 我非常感激任何帮助,因为我将头撞在墙上,试图弄清楚这一点。 It worked in XCode 8 as far as I remember. 据我所知,它在XCode 8中有效。

Had the same exact issue when wanted to build open source C++ project which uses makefiles, hence used External Build System in Xcode 9.2. 当想要构建使用makefiles的开源C ++项目时遇到了同样的问题,因此在Xcode 9.2中使用了外部构建系统。

Followed advice from QuinceyMorris (from here: https://forums.developer.apple.com/thread/96361 ) 遵循QuinceyMorris的建议(来自此处: https ://forums.developer.apple.com/thread/96361)

If you want to run the EBS target, you have to find an external way of providing the command-line arguments you need. 如果要运行EBS目标,则必须找到一种提供所需命令行参数的外部方法。 In my case I added additional arguments to External Build Tool Configuration Arguments field CFLAGS=-mmacosx-version-min=10.12 CXXFLAGS=-mmacosx-version-min=10.12 . 就我而言,我向外部构建工具配置参数字段CFLAGS=-mmacosx-version-min=10.12 CXXFLAGS=-mmacosx-version-min=10.12添加了其他参数CFLAGS=-mmacosx-version-min=10.12 CXXFLAGS=-mmacosx-version-min=10.12 See screenshot attached. 请参阅所附的屏幕截图。

Also check out this SO answer: C++, Mac OS X, Xcode 8 : Compile Boost : Set deployment target to OS X 10.11 还请查看以下SO答案: C ++,Mac OS X,Xcode 8:编译Boost:将部署目标设置为OS X 10.11

在此处输入图片说明

Providing command Line arguments to the External Build Tool Configuration Arguments field did not work for me. 向“外部构建工具配置参数”字段提供命令行参数对我不起作用。 (It's also worth noting that if you disable "Debug executable" while editing the target's scheme, it works - but I'm assuming that that is not something anyone wants). (还值得注意的是,如果在编辑目标方案时禁用“调试可执行文件”,则它可以工作-但我假设那不是任何人都想要的)。 What eventually worked for me was just upgrading to High Sierra (10.13.4). 最终对我有用的只是升级到High Sierra(10.13.4)。 It now builds in Release and Debug mode. 现在,它以发布和调试模式构建。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM