3

I am working on a static library and a sample app, I started this static lib and sample app with Xcode 6.1.1 and so it was working absolutely fine with this version of Xcode.

Now when I updated my Xcode to 6.3 last week my Sample app started giving me lexical or preprocessor issue and it is not recognising entry class file for static library. I didn't change any thing, it still working fine with the Xcode 6.1.1

Update Here are the screenshot of Build settings for Static Library and Test APP

Static Library-->

Static Library

Static Library build Phases -->

enter image description here Test App-->

Test App

Build Phases for Test App. enter image description here

I'm getting some new compile time error as below... enter image description here

above mentioned classes in images are classes from the static library(say, B) which has been included in the another library (say, A). this package included in a test app.

and this is how my Header and user search path respectively looks... Header search path

enter image description here

Suryakant Sharma
  • 3,852
  • 1
  • 25
  • 47
  • Could you please provide full error listing? – ninjaproger Apr 13 '15 at 14:04
  • @ninjaproger sorry, I knew it's bit too late in replying you, but as they says better late than never. so the error say 'lexical or preprocessor issue' and 'xyz.h' file not found and this xyz.h is just a entry point to my static library. – Suryakant Sharma May 26 '15 at 04:57
  • Could you please share any code? Without adding some info it's impossible to help you. – Sulthan May 26 '15 at 19:16
  • @Sulthan what exactly do you need to know, because I can't see any specific code that can be share? I have two static library and one static library using another library and this combination of library I'm using inside a test app. – Suryakant Sharma May 26 '15 at 19:40
  • Could you post a screenshot of your build phases for both your app itself (with the 'Link Binary with Libraries' section expanded) and the static library which contains the file that it says is not found (with the 'Compile Sources' section expanded)? Also, is the file that is not found within the main static library or within the library that the static library you are linking to is using? – Joshua May 27 '15 at 13:44
  • did you delete the sample app and perform a "clean" and rebuild everything? – MDB983 May 27 '15 at 15:56
  • yes @MDB983, I did this so many time but no luck. – Suryakant Sharma May 28 '15 at 04:45
  • @SuryakantSharma Have you seen my comment above? May allow us to further help you with additional information – Joshua May 29 '15 at 16:45
  • @Joshua: Apologies for replying late I was away from my computer. I have update my question. please have a look if this can give you some clues. – Suryakant Sharma Jun 01 '15 at 09:25
  • @SuryakantSharma No worries. Thanks for the screenshots, could you also provide similar for the build **phases** section too? – Joshua Jun 01 '15 at 09:30
  • @SuryakantSharma Thank you, what was the name of the file you tried to import that caused the error? – Joshua Jun 01 '15 at 16:18
  • @Joshua I have done something I don't know what though, but now I'm getting new set of error, I have already attached ScreenShot. Please have a look. – Suryakant Sharma Jun 01 '15 at 18:01

4 Answers4

3
file was built for archive which is not the architecture being linked (i386)

This error means that

Your static library does not have any binaries for the architecture your Test App is using (i386), and therefore you cannot link with the library.

The first image verifies this - you are building the static library only for armv7 and arm64.

Are you trying to run Test App in the simulator? Try changing to run on a device, which should make the architecture link errors go away. To run on the simulator, you need to compile simulator binaries for your static library (typically i386 and/or x86_64).

ChenYilong
  • 8,543
  • 9
  • 56
  • 84
damian
  • 3,604
  • 1
  • 27
  • 46
2

Ensure that under the User Header Search Paths and/or Header Search Paths build setting of the main app, the path to the static library's project directory is included. Set the path to recursive to ensure it detects all headers.

Joshua
  • 15,200
  • 21
  • 100
  • 172
  • User Header Search Paths and/or Header Search Paths are looks fine to me. for your reference I'm attaching screenshot. Now I'm getting some new errors, attaching screenshot for those as well. Please have a look. – Suryakant Sharma Jun 01 '15 at 17:45
  • did you get any clue @Joshua ? – Suryakant Sharma Jun 01 '15 at 17:55
  • @SuryakantSharma In the build settings of the static library try changing `Build Active Architecture Only` from `YES` to `NO` – Joshua Jun 01 '15 at 18:09
  • @SuryakantSharma Has my suggestion above been of any use? – Joshua Jun 02 '15 at 11:13
  • unfortunately not. but I have updated my question. now I'm getting error for another static library. – Suryakant Sharma Jun 02 '15 at 11:16
  • @SuryakantSharma Do you mean the errors listed under 'I'm getting some new compile time error as below... '? If so did my suggestion of changing `Build Active Architecture Only` from `YES` to `NO` in the static library and cleaning the project not help? – Joshua Jun 02 '15 at 11:45
  • No it didn't Joshua. I tried doing the same. As I mentioned in my question after error screenshot that these file are from the static library that's included in another library and this second library included in test app. I don't know whether I'm able to make you understand properly or not – Suryakant Sharma Jun 02 '15 at 12:07
  • @SuryakantSharma I understand regarding the two static libraries, one included in another, my suggestion applied to both so that is a shame it did not work – Joshua Jun 02 '15 at 13:31
  • that's ok if didn't work buddy. I think somewhere I'm missing something. I'll fix this and let you know. – Suryakant Sharma Jun 02 '15 at 18:22
1

I met similar issue some time ago.

Solution #1 Try to do code Analysis: XCode -> Product > Analyze https://developer.apple.com/library/ios/recipes/xcode_help-source_editor/chapters/Analyze.html

Solution #2 Try re-create your project from new project step-by-step by coping files from your current project. Maybe at some step you will get the same issue, so you will be able to localise the issue.

Vlad
  • 3,465
  • 1
  • 31
  • 24
1

Xcode 6.3 uses swift 1.2 and there a minor changes that need to be made in order to get it running. The preprocessor issue happened with one of my projects too.

You will firstly need to open your app delegate and update the didFinishLaunching methods signature to

func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool

You may also need to change as to as! or as? in some places.

I can only help anymore if you post some code, especially the lines which are showing the error.

Ankit Goel
  • 6,257
  • 4
  • 36
  • 48
  • issue shown in `ViewController.h` where I have added entry point of `Static library`. it simple say lexical or preprocessor issue / file not found. btw I'm using objective-c – Suryakant Sharma Jun 01 '15 at 11:11