Abhinav
Abhinav

Reputation: 38162

#import "test.h" Vs #import <test.h>

What is the difference between importing a header file within "" and within <>?

Like #import "test.h" Vs #import <test.h>

Upvotes: 2

Views: 213

Answers (3)

ughoavgfhw
ughoavgfhw

Reputation: 39925

It will change the search path for the file. Using <> tells the compiler to look through the system path for the proper file/framework, while using "" tells the compiler that the path is relative to the current file.

For example, #import <path/to/file.h> will look through the system paths for the file test.h. The paths include /usr/include and /System/Library/Frameworks, where the first component of the path is treated as the framework to start at. Example paths searched are /usr/include/path/to/file.h and /System/Library/Frameworks/path.framework/Headers/to/file.h. #import "path/to/file.h" will only search the current folder, following the path to find the file, meaning only ./path/to/file.h is searched.

Upvotes: 4

saadnib
saadnib

Reputation: 11145

"" is for local include while the <> for global include

for more info visit this page

http://msdn.microsoft.com/en-us/library/36k2cdd4%28VS.80%29.aspx

Upvotes: 1

Justin808
Justin808

Reputation: 21522

" is for a local include, the .h is part of your application. < is for a system include, the .h is part of a installed library.

Upvotes: 1

Related Questions