1

I was running my project yesterday with these import files:

#import "sip/NgnSipPreferences.h"
#import "services/impl/NgnBaseService.h"
#import "services/INgnSipService.h"

but today I'm getting error on them. It says that 'sip/NgnSipPreferences.h' file not found. but when I remove sip/ making it "NgnSipPreferences.h" then it gets read.

Why did this happen? I don't want to remove the path where the header file comes from because it's so many and I think it's the correct way.

How do I fix this?

Jongers
  • 595
  • 1
  • 9
  • 29
  • Well, this is no prefix-header. You could #import those 3 headers in your prefix file, no need to import them in every single class. – Jörn Buitink Dec 15 '15 at 06:56
  • They are actually codes from idoubs. They were perfectly fine yesterday and now I'm getting error on each one of them with .h file. – Jongers Dec 15 '15 at 07:01
  • Have you checked the build log to see what `-I` options are being passed to the compiler? – trojanfoe Dec 15 '15 at 07:15
  • I haven't tried that one yet, but I'll do it as soon as my Xcode finish updating. (It suddenly updates). What should I check in the build log? – Jongers Dec 15 '15 at 07:28
  • How you have configured this files ? using cocoapod ? or copying the folders ? If you have copy the folders then set the user header search path in build settings. – Wolverine Dec 15 '15 at 07:53

1 Answers1

2
#import "sip/NgnSipPreferences.h"

is importing NgnSipPreferences.h from the folder sip/, relative to the file importing it.

So you have 2 solutions, if you don't want to change the #import (usually it's better to do as you say, leaving the imports/includes in the proper place):

  1. you move the .m files in the proper place (above the sip/ directory), or
  2. you add the folder above the sip/ directory to the HEADER_SEARCH_PATHS parameter in your Build_Settings (for example, if you have sip/ in the root folder, just add ${SRCROOT} without recursion - in this case the compiler will for sure find your header file ${SRCROOT}/sip/NgnSipPreferences.h).

Note: to get confidence with the topic, read Adding system header search path to Xcode

Note: if it was working up to yesterday, but not today, you can easily understand what happened if you installed GIT or another versioning tool, but sometimes Xcode is not cleaning all the caches properly, so your problem can be caused much before the date you thought. For this reason, not only "Clean" but also removing the directory DerivedData is quite useful! (I do regularly when something "strange" is happening...)

Community
  • 1
  • 1
Prak
  • 302
  • 1
  • 9
  • I revert back to my last codes in git but it is still not working so I tried removing the directory DerivedData and putting it back again and is now working! Thanks for the advice! – Jongers Dec 21 '15 at 02:06