Where is the header files (.h) ?

27 views
Skip to first unread message

CAI

unread,
Oct 18, 2011, 6:46:33 AM10/18/11
to iPhone Wax
I'm trying to learn extending wax by reading files in 'extensions'
directory,
Then the files tree like this:

├── filesystem
│   ├── wax_filesystem.h
│   └── wax_filesystem.m
├── json
│   ├── Rakefile
│   ├── wax_json.c
│   ├── wax_json.h

└── test
├── wax_test.h
└── wax_test.m

then drag the folder to xcode

but in main.m
i could only import header file like this:
#import<wax_text.h>
when using #import<wax/wax_test.h> ,report file not found error.

how can I use "wax/wax_test.h" like other entensions ?

Thx for your help!

Corey Johnson

unread,
Oct 18, 2011, 12:25:50 PM10/18/11
to ipho...@googlegroups.com
It sounds like you are using the wax framework, that is usually when wax/wax_something.h is used. If you are not using the framework, let me know and ignore everything else I say in this email.

If you just drag your files into Xcode, you don't need to use the wax prefix, you can just use #import "wax_yourthing.h" if you want a prefix it gets a bit confusing because you need to play around with the header fields in your Xcode project settings (I forget how to do it off the top of my head).

But using #import "wax_text.h" will work just fine.

Corey

CAI

unread,
Oct 18, 2011, 9:35:20 PM10/18/11
to iPhone Wax
No,neither wax framework nor wax project generated by wax-template.
I draged the "wax group" from other project(generated by wax-template)
to this project and #import "wax/wax_filesystem.h" works but my own
files can't be imported like this.

Alexei Sholik

unread,
Oct 19, 2011, 10:06:46 AM10/19/11
to ipho...@googlegroups.com
If you dragged a group (not a folder reference) to your project, you
may simply write #import "you_header.h".
If you'd like to write #import "wax/your_header.h", go to the project
settings and look for the parameter called "user header search paths"
in your target's build settings and add a path of the "wax" directory
containing "your_header.h"
If you'd like to write #import <wax/your_header.h> then do the same,
but this time for the parameter called "header search paths".

When we're talking about #include, the difference between "" and <> is
that the former performs the search relative to where the .c file is
(and then also searches the paths you specified in "user header search
paths"). The bracket version (<>) searches relative to your system's
include directory (/usr/include on UNIXes, C:\Program
Files\MSVS\...\something\...\include on Windows) and then also
searches the paths specified in ("header search paths").

Here's a reference documentation on the subject from MS -->
http://msdn.microsoft.com/en-us/library/36k2cdd4(v=vs.80).aspx

The #import directive is almost the same as #include, but it may have
some dissimilarities like not actually looking in the right place when
you write #import "wax/your_header.h". The general rule of thumb is to
add directories with your own code as groups (not as folder
references) and always write #import "your_header.h".

Hope this helps.

--
Best regards,
Alexei Sholik

CAI

unread,
Oct 19, 2011, 10:41:43 PM10/19/11
to iPhone Wax
Thank you very very much!
Now I know how to get it works ,but remain can't imagine why it's fine
describing in first post

In the project , the physical directory 'wax' doesn't contain files
like "wax_filesystem.h"(it's in wax/lib/extensions/filesystem)
Any idea ?

Alexei Sholik

unread,
Oct 23, 2011, 6:45:55 PM10/23/11
to ipho...@googlegroups.com
I'm not sure I understand what issue you mentioned specifically.

> but in main.m
> i could only import header file like this:
> #import<wax_text.h>
> when using #import<wax/wax_test.h> ,report file not found error.

I believe the 'wax' directory is added to the 'Header Search Paths'
and is searched recursively (this setting should have the value
'wax/*' or 'wax/**', I don't remember exactly). So you can import wax
files with #import <wax_text.h> because the 'wax' directory is
searched recursively, but #import <wax/wax_test.h> doesn't work
because the 'wax' directory itself does not contain that file, it is
located in one of the subdirectories.

> how can I use "wax/wax_test.h" like other entensions ?

I haven't looked at wax extensions close enough, so I'm afraid I can't
give you a relevant advice for this one. I suggest you take a look at
the directory structure for those extensions and project settings I
mentioned earlier and try to deduce how the compiler would find the
necessary files given your #import directive.

Reply all
Reply to author
Forward
0 new messages