Xcode8.1以后 Build Settings Linking 默认没有 Other Linker Flags选项的解决方法

以项目中集成第三方开源库为例,经常需要修改Other Linker Flags选项,默认xcode8.1没有这个选项(或者没有找到),此时:

找到项目文件 :*.xcodeproj  ,右键显示包内容,用文本编辑器打开:project.pbxproj

定位到:

/* Begin XCBuildConfiguration section */

下面一般有两个配置: Debug 和 Release

加入如下内容:

OTHER_LDFLAGS = (

"-lctemplate-iOS",

"-letpan-ios",

"-lxml2",

"-lsasl2",

"-liconv",

"-ltidy",

"-lz",

"-lc++",

"-lresolv",

"-stdlib=libc++",

"-ObjC",

);

完整配置文件中相关内容如下:

/* Begin XCBuildConfiguration section */

DB123E481C3CA6C5004FCAA5 /* Debug */ = {

isa = XCBuildConfiguration;

buildSettings = {

ALWAYS_SEARCH_USER_PATHS = NO;

CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";

CLANG_CXX_LIBRARY = "libc++";

CLANG_ENABLE_MODULES = YES;

CLANG_ENABLE_OBJC_ARC = YES;

CLANG_WARN_BOOL_CONVERSION = YES;

CLANG_WARN_CONSTANT_CONVERSION = YES;

CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;

CLANG_WARN_EMPTY_BODY = YES;

CLANG_WARN_ENUM_CONVERSION = YES;

CLANG_WARN_INT_CONVERSION = YES;

CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;

CLANG_WARN_UNREACHABLE_CODE = YES;

CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;

"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";

COPY_PHASE_STRIP = NO;

DEBUG_INFORMATION_FORMAT = dwarf;

ENABLE_STRICT_OBJC_MSGSEND = YES;

ENABLE_TESTABILITY = YES;

GCC_C_LANGUAGE_STANDARD = gnu99;

GCC_DYNAMIC_NO_PIC = NO;

GCC_NO_COMMON_BLOCKS = YES;

GCC_OPTIMIZATION_LEVEL = 0;

GCC_PREPROCESSOR_DEFINITIONS = (

"DEBUG=1",

"$(inherited)",

);

GCC_WARN_64_TO_32_BIT_CONVERSION = YES;

GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;

GCC_WARN_UNDECLARED_SELECTOR = YES;

GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;

GCC_WARN_UNUSED_FUNCTION = YES;

GCC_WARN_UNUSED_VARIABLE = YES;

IPHONEOS_DEPLOYMENT_TARGET = 10.1;

MTL_ENABLE_DEBUG_INFO = YES;

ONLY_ACTIVE_ARCH = YES;

OTHER_LDFLAGS = (

"-lctemplate-ios",

"-letpan-ios",

"-lxml2",

"-lsasl2",

"-liconv",

"-ltidy",

"-lz",

"-lc++",

"-lresolv",

"-stdlib=libc++",

"-ObjC",

);

SDKROOT = iphoneos;

};

name = Debug;

};

DB123E491C3CA6C5004FCAA5 /* Release */ = {

isa = XCBuildConfiguration;

buildSettings = {

ALWAYS_SEARCH_USER_PATHS = NO;

CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";

CLANG_CXX_LIBRARY = "libc++";

CLANG_ENABLE_MODULES = YES;

CLANG_ENABLE_OBJC_ARC = YES;

CLANG_WARN_BOOL_CONVERSION = YES;

CLANG_WARN_CONSTANT_CONVERSION = YES;

CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;

CLANG_WARN_EMPTY_BODY = YES;

CLANG_WARN_ENUM_CONVERSION = YES;

CLANG_WARN_INT_CONVERSION = YES;

CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;

CLANG_WARN_UNREACHABLE_CODE = YES;

CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;

"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";

COPY_PHASE_STRIP = NO;

DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";

ENABLE_NS_ASSERTIONS = NO;

ENABLE_STRICT_OBJC_MSGSEND = YES;

GCC_C_LANGUAGE_STANDARD = gnu99;

GCC_NO_COMMON_BLOCKS = YES;

GCC_WARN_64_TO_32_BIT_CONVERSION = YES;

GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;

GCC_WARN_UNDECLARED_SELECTOR = YES;

GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;

GCC_WARN_UNUSED_FUNCTION = YES;

GCC_WARN_UNUSED_VARIABLE = YES;

IPHONEOS_DEPLOYMENT_TARGET = 10.1;

MTL_ENABLE_DEBUG_INFO = NO;

SDKROOT = iphoneos;

VALIDATE_PRODUCT = YES;

};

name = Release;

};

DB123E4B1C3CA6C5004FCAA5 /* Debug */ = {

isa = XCBuildConfiguration;

buildSettings = {

ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;

CODE_SIGN_IDENTITY = "iPhone Developer";

INFOPLIST_FILE = mailCore2Test/Info.plist;

IPHONEOS_DEPLOYMENT_TARGET = 8.1;

LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";

PRODUCT_BUNDLE_IDENTIFIER = com.user.mailCore2Test;

PRODUCT_NAME = "$(TARGET_NAME)";

};

name = Debug;

};

DB123E4C1C3CA6C5004FCAA5 /* Release */ = {

isa = XCBuildConfiguration;

buildSettings = {

ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;

CODE_SIGN_IDENTITY = "iPhone Developer";

INFOPLIST_FILE = mailCore2Test/Info.plist;

IPHONEOS_DEPLOYMENT_TARGET = 8.1;

LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";

OTHER_LDFLAGS = (

"-lctemplate-ios",

"-letpan-ios",

"-lxml2",

"-lsasl2",

"-liconv",

"-ltidy",

"-lz",

"-lc++",

"-lresolv",

"-stdlib=libc++",

"-ObjC",

);

PRODUCT_BUNDLE_IDENTIFIER = com.user.mailCore2Test;

PRODUCT_NAME = "$(TARGET_NAME)";

};

name = Release;

};

/* End XCBuildConfiguration section */

你可能感兴趣的:(Xcode8.1以后 Build Settings Linking 默认没有 Other Linker Flags选项的解决方法)