Tag:

编译iOS 7的x264

我在为iOS编译x264时出错。 我有苹果LLVM 5.0版(clang-500.2.75)(基于LLVM 3.3svn)Xcode版本5.0(5A1413)。 我正在编译x264-snapshot-20130925-2245。 configuration: CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang ./configure \ –host=arm-apple-darwin \ –sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk \ –prefix=armv7 \ –extra-cflags='-arch armv7' \ –extra-ldflags="-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/lib/system -arch armv7" \ –enable-pic \ –enable-static 出错: common/arm/cpu-aS:29:7: error: unknown token in expression .align ^ common/arm/cpu-aS:139:5: error: instruction 'suble' can not set flags, but 's' suffix specified subles ip, ip, #1 ^

有条件地隐藏编译器的代码

所以这是问题。 我准备尽快为iOS发布更新,以解决iOS 7中的一些问题。为此,我需要使用一些特定的iOS 7function/types。 我已经绝对确定,iOS 7的代码只能在iOS 7上执行,并在iOS 7之前回退到不同的代码。当然,我不允许使用当前的Xcodetesting版进行提交,所以我试图编译与当前的Xcode版本。 但是,我似乎无法find一种方法来禁用此特定的警告: Use of undeclared identifier '<Redacted>'. 有谁知道使用#pragma禁用此警告的方法。 我已经尝试了一堆不同的包括 -w , -Weverthing , -Wall 但似乎没有任何工作。 更新答案:当然,你不能,因为编译器不能编译一个它一无所知的标识符。 我的解决scheme是简单地创build一个#define : #define <redacted> 1 更新2下面的答案实际上使得它更容易。 我已经创build了一个#define Xcode5Code(code, alt) ,它允许我有条件地执行代码块。 通过使用@maddy的解决scheme修改它: #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 #define Xcode5Code(code, alt) code #else #define Xcode5Code(code, alt) alt #endif 这使我可以通过使用以下方法轻松地从编译器隐藏代码块: Xcode5Code({ //Code to be execute only […]