• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Newbie Question - #include scope -- Thanks!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Newbie Question - #include scope (From: Gil Dawson <email@hidden>)
 >Re: Newbie Question - #include scope (From: Steve Checkoway <email@hidden>)
 >Re: Newbie Question - #include scope (From: "Mark Wagner" <email@hidden>)
 >Re: Newbie Question - #include scope (From: Jeremy Pereira <email@hidden>)
 >Re: Newbie Question - #include scope (From: Etienne Guérard <email@hidden>)

  • Prev by Date: Fwd: embarrassing "Find" question in XCode 3: it stopped working? (fixed)
  • Next by Date: keyedobjects.nib vs. objects.nib
  • Previous by thread: Re: Newbie Question - #include scope
  • Next by thread: Re: Newbie Question - #include scope
  • Index(es):
    • Date
    • Thread