Friday, January 17, 2014

How to solve Lexical or Preprocessor Issue

While developing iOS project,  might be you get chance to face the Lexical or Preprocessor Issue. As a iOS developer i too face such issue. We have often think then how to solve this issue? For new developer or those who were not aware how to solve this issue, for them today i am explaining  how to fix this.

This kind of issue generally arise due to framework or 3rd party library is not imported properly. For that ensure the framework and all it's headers are imported into your project properly. When you shift your code from one pc to another, then  also get this kind of issue for some libraries. The reason for that is due to project "Search Paths" in settings are mismatch. To resolve this remove old instance of the path from "Search Paths" option from Build Settings.

Project > Select Project Target > Build Settings > Search Paths (see below image for reference)



                   When you move your code from  one pc to another,  and your manual added library path is of your pc is not match in another pc, so try to remove library from reference and again add it manually. To avoid this issue prefer to use "cocoapods" library management tool. For new or those who were not aware with the cocoa pods refer this tutorial. CocoaPods is the best way to manage library dependencies in iOS and OS X projects. On above tutorial i explain how to mange and install cocoapods on mac.

Give your comment if require my help to fix this kind of error for ios coding, Happy coding. 


10 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. Thanks helped allot

    ReplyDelete
  3. I have created new project and include UISearchDisplayDelegate which is deprecated in ios 8, So trying to put checking of ios version as bellow:
    #if !IOS_NEWER_OR_EQUAL_TO_8
    UISearchDisplayDelegate
    #endif
    and getting the lexical or preprocessor issue

    ReplyDelete
  4. Thanks from the Philippines!
    Raymond

    ReplyDelete
  5. I have the issue for facebooksdk/facebooksdk.h
    I have done all the possible steps of adding, cleaning, etc. But the error continues. It says lexical/preproccessor error; facebooksdk/facebooksdk.h file not found within appdelegate.h

    ReplyDelete
  6. 'MobileVLCKit/MobileVLCKit.h' file not found

    ReplyDelete
    Replies
    1. Try to follow wiki from MobileVLC Kit. Reference: https://cocoapods.org/pods/MobileVLCKit

      Delete