对文件进行前缀以避免外部框架之间的符号冲突

我在我的IOS代码中使用两个外部框架。 这两个框架内部使用PLCrashReoprter框架,由于我得到重复的符号错误。

现在框架之一,即崩溃记者框架正在提供添加前缀到文件名/符号。 以下是在nameSpace.h中添加前缀的代码:


 #define PLCRASHREPORTER_PREFIX AcmeCo #ifdef PLCRASHREPORTER_PREFIX // We need two extra layers of indirection to make CPP substitute // the PLCRASHREPORTER_PREFIX define. #define PLNS_impl2(prefix, symbol) prefix ## symbol #define PLNS_impl(prefix, symbol) PLNS_impl2(prefix, symbol) #define PLNS(symbol) PLNS_impl(PLCRASHREPORTER_PREFIX, symbol) #define PLCrashMachExceptionServer PLNS(PLCrashMachExceptionServer) #define PLCrashReport PLNS(PLCrashReport) #define PLCrashReportApplicationInfo PLNS(PLCrashReportApplicationInfo) #define PLCrashReportBinaryImageInfo PLNS(PLCrashReportBinaryImageInfo) #define PLCrashReportExceptionInfo PLNS(PLCrashReportExceptionInfo) 

现在错误“ comes Apple Mach-O Linker Error

 Undefined symbols for architecture i386: "_OBJC_CLASS_$_AcmeCoPLCrashReport", referenced from: objc-class-ref in CrashReporter.o 

我已经添加了所有包含的nameSpace.h文件。

请引导我作为尝试所有可能的事情,但没有用。 提前致谢!!

您需要使用相同的macros定义重新编译相应的framwork(所有.c文件),以便导出并使用修改的符号名称。