How #import searches for files in Objective-C

I can find some information on this topic. I now understand that

#import <my.h> // searches in the system paths
#import "my.h" // searches in the same dir as the source file - is that right?

I have a static library with .h files elsewhere. Can I find a compiler for a new folder for .h files C # import "my.h", as in VC ++

+3
source share
3 answers

Your understanding is pretty much correct, except that it #import "my.h"searches in the same directory as the source file and all the system paths (the same as the search #import <my.h>).

I have a static library with .h files elsewhere. Can I find a compiler for a new folder for .h files C # import "my.h", as in VC ++

. -I gcc. , path/to/my-other-dir, -Ipath/to/my-other-dir gcc. Xcode, , ; , .

+3

Objective-C, #import #include, . , #include .

<…> "…". , . GCC <…> :

 /usr/local/include
 <libdir/gcc/target/version>/include
 /usr/<target>/include
 /usr/include

, -I -F. "…" , , -iquote, .

. http://gcc.gnu.org/onlinedocs/cpp/Search-Path.html.

+1

Source: https://habr.com/ru/post/1744175/


All Articles