Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

#include, gcc, -I, -I-, and same named files



Hello.

I'm working on a project which is using Objective C and Cocoa for the GUI,
vanilla C++ for the cross-platform engine code, and then Objective C++ when
the GUI and engine have to meet.

In the C++ code I have a class named foo::string (class "string" within
"foo" namespace). The source file is named foo.string.cpp and the header is
named "string.h"; both files reside within a directory named "foo". When the
header is #included, it is done so this way:

#include "foo/string.h"

To get this to pick up, I added a Headers Search Path to the settings of my
target, and Project Builder and gcc do seem to be picking up the file.
However, whenever any other code in the project tries to #include <string.h>
(the standard C library system header), it brings in the foo/string.h file
instead of /usr/include/string.h.

Reading the gcc docs and looking at the details of how PB constructs the
command line to send to gcc, I see how the -I option works and that explains
why the "foo/string.h" file gets picked up when <string.h>
(/usr/include/string.h) is desired. I then read about this -I- option for
gcc, which seems to be what I want... if I placed that after my custom
Header Search Path supposedly it would only search that path on #include
"file" and not #include <file>. Maybe I'm not understanding the option
correctly, maybe I'm not placing it in the right place (I've tried editing
the Search Path, I tried entering this in the GCC Compiler Settings Other C
Compiler Flags field, I tried adding a custom OTHER_CFLAGS field to my Build
Settings (since I already have some things I need to pass via OTHER_CFLAGS
on a per-build style basis). Nothing seems to work.

How can I get this working so that when the statement is:

#include "foo/string.h"

it picks up the foo/string.h, and when the statement is:

#include <string.h>

it picks up the system's string.h?

(and please, no arguments about the filename or suggestions to just rename
the foo/string.h file to some unique name... that's not a viable option in
my situation).

Thanx for any help you can give. :-)

--
John C. Daub }:-)>=
<mailto:email@hidden> <http://www.hsoi.com/>
"I have a big head. My head is huge!" - Space Ghost
_______________________________________________
projectbuilder-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/projectbuilder-users
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.