Reputation: 197
I made a static library(.a) following the instructions of Ray Wenderlich, compiled it without errors and warnings, and then I included it on a new project. When I tried to build the new project, I got this error:
/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
Why do I get these errors on the library, if I compiled correctly?
Upvotes: 2
Views: 861
Reputation: 6847
This is completely wrong:
#import "libInsightsLib.a"
#import
is for importing header files, i.e. source-code declarations. You are telling it to import a compiled binary library, and then the compiler is freaking out.
You need to use #import
with the .h for whatever you're trying to use from that library. The .a goes in the link phase of your app's build target. Go back to Ray's tutorial, I'm sure it'll have those details.
Upvotes: 2