2015-09-24 41 views
2

我按照Ray Wenderlich的说明创建了一个静态库(.a),并且没有错误和警告地编译它,然后将它包含在一个新项目中。当我试图建立新的项目,我得到这个错误:静态库在Xcode上给出了奇怪的错误

error screenshot

/Users/.../PruebaInsights/PruebaInsights/libInsightsLib.a:1:1: Source file is not valid UTF-8 
/Users/.../PruebaInsights/PruebaInsights/libInsightsLib.a:1:5: Null character ignored 
/Users/.../PruebaInsights/PruebaInsights/libInsightsLib.a:1:8: Expected identifier or '(' 
/Users/.../PruebaInsights/PruebaInsights/libInsightsLib.a:2:3: Invalid filename for line marker directive 
/Users/.../PruebaInsights/PruebaInsights/libInsightsLib.a:3:10: Null character ignored 

为什么我坐上库这些错误,如果我正确编译?

回答

2

这是完全错误:

#import "libInsightsLib.a" 

#import是用于导入头文件,即源代码的声明。你告诉它导入一个已编译的二进制库,然后编译器就吓坏了。

您需要使用#import和.h作为您试图从该库使用的任何内容。 .a会进入应用程序构建目标的链接阶段。回到Ray的教程,我确信它会有这些细节。

+0

这就是对的!谢谢! – KurroCantos

+0

你可以建议如何导入呢? –