本文介绍了苹果PrefPane示例无法构建与clang错误反对-fobjc-arc和-fobjc-gc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个偏好窗格作为学习OS X开发的一部分。在下载Apple的,并试图构建项目我得到以下错误:



clang:error:不能同时指定'-fobjc-arc '和'-fobjc-gc'



在构建设置中关闭垃圾收集可以正确构建项目,但是一旦在本地机器上安装了首选项窗格示例不会开始说,

您无法打开PrefsPane首选项,因为它不能在基于Intel的Mac上运行。



我尝试了架构(10.6,10.7)和Objective-C自动引用计数(是,否)和Objective-C垃圾收集(支持(-fobjc-gc),不支持,必需(仅限-fobjc-gc)可用。虽然一些组合允许项目构建,但我无法获得加载首选项窗格。



解决方案

使用Xcode 4.3.2为OS X 10.7构建和部署首选项窗格所需的架构,ARC和GC设置我只是偶然发现了。所以,结果是(根据苹果dev文档):

有关详细信息,请转到。



所以你不能使用ARC。只有GC。


I'm trying to build a preference pane as a part of learning OS X development. After downloading Apple's preference pane example code and trying to build the project I get the following error:

clang: error: cannot specify both '-fobjc-arc' and '-fobjc-gc'

Turning off garbage collection in Build Settings allows the project to build properly, but once the preference pane example is installed on the local machine it won't start saying,

"You can’t open PrefsPane preferences because it doesn’t work on an Intel-based Mac."

I've tried every combination of architecture (10.6, 10.7) and Objective-C Automatic Reference Counting (Yes, No) and Objective-C Garbage Collection (Supported (-fobjc-gc), Unsupported, Required (-fobjc-gc only) available. While some combinations do allow the project to build, I can't get the preference pane to load.

What are the proper architecture, ARC, and GC settings necessary to build and deploy a preference pane for OS X 10.7 using Xcode 4.3.2?

解决方案

I just stumbled upon this myself. So turns out (accoridng to Apple dev docs):

For more info go to Updating Preference Panes for Snow Leopard and Beyond.

So you can't use ARC. Only GC.

这篇关于苹果PrefPane示例无法构建与clang错误反对-fobjc-arc和-fobjc-gc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 23:32