Re: Newbie Question - #include scope -- Thanks!
Re: Newbie Question - #include scope -- Thanks!
- Subject: Re: Newbie Question - #include scope -- Thanks!
- From: Gil Dawson <email@hidden>
- Date: Fri, 12 Dec 2008 14:31:14 -0800
Thanks to all who responded. Boy, do I know a lot more about XCode now!
And the winner is...
On Dec 11, 2008, at 1:54 A, Etienne Guérard wrote:
you just have to uncheck testadd.c from your current target, so
that it won't get compiled when you build your target.
That works. It also happens to fit my need precisely, as I'm trying
to test someone else's code, which was written for a very different
IDE, while modifying as little as possible.
On Dec 10, 2008, at 6:58 P, Steve Checkoway wrote:
My guess is that Xcode is trying to compile testadd.c as well as
including it into test.c. That's where you're getting the error.
Bingo. I was under the now-obviously-mistaken impression that
command-K compiled only the selected module.
On Dec 10, 2008, at 3:52 P, Mark Wagner wrote:
According to the C standard, the code should compile without problems.
Since it doesn't, it's a problem with Xcode.
Precisely what I thought. Thanks for the support, Mark. The problem
is sorta with XCode, or my operation of it, anyway, in that I hadn't
expected it to compile testadd.c twice. I guess we've both learned
something.
On Dec 10, 2008, at 3:07 P, Eric Johnson wrote:
Check out
http://c-faq.com/cpp/hfiles.html
Thanks for the reference to a very interesting article, Eric.
On Dec 10, 2008, at 11:44 A, Jeremy Pereira wrote:
To make this work, you should
- delete your #include of testadd.c in test.c
- define MyData in one of the of the .c files
- change the line in test.h to
extern int MyData;
- include test.h in both .c files.
- find a good book on programming in C and review the differences
between extern and static scoping.
Thanks, Jeremy, for a clear description of the standard form. Would
you recommend a particular book?
Thank you all for a very enlightening introduction to XCode.
--Gil _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden