• 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: M Pulis <email@hidden>
  • Date: Wed, 10 Sep 2008 10:06:10 -0700

The second thing, #include foo.hpp... actually tried both, foo.hpp or foo.cpp. not at the same time, of course. It is in the project Source folder.

Among other errors, I may have chosen the wrong Xcode template to do this project. It really is a DLL written in c and c++, may not need to remain as a DLL on the Macintosh.

Ahhhh... silly me, thinking that #include of a header file would be like Pascal Uses, given the importance of the file suffices.....

Many thanks, Sherm, for the insight and reading links. I will be busy checking them out.

Gary

On Sep 10, 2008, at 9:36 AM, Sherm Pendley wrote:

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

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>)
 >Re: bringing windows c++ code to Macintosh (From: "Sherm Pendley" <email@hidden>)

  • Prev by Date: DYLD_LIBRARY_PATH no longer valid in environment.plist ?
  • Next by Date: Re: Xcode environment variables
  • Previous by thread: Re: bringing windows c++ code to Macintosh
  • Next by thread: Re: bringing windows c++ code to Macintosh
  • Index(es):
    • Date
    • Thread