• 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: bringing windows c++ code to Macintosh
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bringing windows c++ code to Macintosh


  • Subject: Re: bringing windows c++ code to Macintosh
  • From: "Sherm Pendley" <email@hidden>
  • Date: Wed, 10 Sep 2008 12:36:12 -0400

On Wed, Sep 10, 2008 at 4:54 AM, M Pulis <email@hidden> wrote:
Ok, thats a problem. Only the .hpp or .cpp was included, not both.

I'm not certain we're talking about the same thing. When you say "included," what are you referring to? Including a file in the Xcode project? Or using an #include macro in your code? I'm talking about the second.
 
So, given Foo.cpp and Foo.hpp, to be used from main.m, what should main.m look like?

In main.m, you would #include "Foo.hpp", but you would *not* #include any .cpp, .m, .mm, .c, or any other source files - #include is for headers only. In Pascal terms, if I remember them correctly, interface and implementation blocks are split into separate header and source files, respectively.

The files are split like this because, unlike Pascal's "using", the #include used by C and its relatives is just a macro - you can think of '#include "filename"' as "{$I filename}".

There's a couple of old articles at MacTech that may help - the "Pascal Programmer's Guide to Understanding C":

<http://www.mactech.com/articles/mactech/Vol.09/09.12/PascalUnderstandsC/>
<http://www.mactech.com/articles/mactech/Vol.10/10.01/PascalCII/index.html>

There's also a book on the subject, titled "C++ For Pascal Programmers":

<http://www.cs.ucsc.edu/~pohl/pascal.html>

Hope this helps!

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net

 _______________________________________________
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

  • Follow-Ups:
    • Re: bringing windows c++ code to Macintosh
      • From: M Pulis <email@hidden>
References: 
 >bringing windows c++ code to Macintosh (From: M Pulis <email@hidden>)
 >Re: bringing windows c++ code to Macintosh (From: "Michael Williamson" <email@hidden>)
 >Re: bringing windows c++ code to Macintosh (From: M Pulis <email@hidden>)
 >Re: bringing windows c++ code to Macintosh (From: "Sherm Pendley" <email@hidden>)
 >Re: bringing windows c++ code to Macintosh (From: "Sherm Pendley" <email@hidden>)

  • Prev by Date: duplicate symbols in debug build only
  • Next by Date: Re: SOLVED: How to build 64-bit for current architecture only?
  • Previous by thread: Re: bringing windows c++ code to Macintosh
  • Next by thread: Re: bringing windows c++ code to Macintosh
  • Index(es):
    • Date
    • Thread