Skip navigation.
 
mlRE: how to build c++ file and create its instance in anotherobjective-c class
FROM : Kartik Ganesan
DATE : Fri Jun 06 21:18:13 2008

Can you please provide a sample with one cocoa file (.m & .h) and c++ file
(.mm & .h) plase?

Thanks

Kartik


-----Original Message-----
From: cocoa-dev-bounces+kganesan=databasepublish.<email_removed>
[mailto:cocoa-dev-bounces+kganesan=databasepublish.<email_removed>] On
Behalf Of Jean-Daniel Dupas
Sent: Friday, June 06, 2008 11:00 AM
To: Tang Ke
Cc: <email_removed>
Subject: Re: how to build c++ file and create its instance in
anotherobjective-c class


Le 6 juin 08 à 16:53, Tang Ke a écrit :

> Hi,
> I'm new to iphone os programming and my project involves to build c+
> + files
> within the xcode cocoa touch environment.
>
> So i tried to create a new cocoa touch project and use the interface 
> builder
> to add a button and a label.
> So that when i press the button, the label would show the result of 
> the
> "add()" method i call from the following c++ file.
>
>
> I then add a new c++ file called Adder.cpp which looks like this:
>
> class Adder{
>
> public:
>
> Adder();
>
> int add(int x,int y){
>
> return x+y;
>
> }
>
> };
>
>
> Simple enough, following the example i found from
>

http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Article
s/chapter_12_section_3.htm


The first thing to do it to learn how to search the mailine list 
archive. For example try to search for iPhone and NDA:

http://www.cocoabuilder.com/search/archive/cocoa?words=iphone+nda

Then try to compile your file as an obj-c++ file and not as a C++ 
file. To do this, rename it using the .mm extension (instead of .m 
or .cpp).

Related mailsAuthorDate
mlhow to build c++ file and create its instance in another objective-c class Tang Ke Jun 6, 16:53
mlRe: how to build c++ file and create its instance in another objective-c class Jean-Daniel Dupas Jun 6, 16:59
mlRe: how to build c++ file and create its instance in another objective-c class Tang Ke Jun 6, 17:04
mlRe: how to build c++ file and create its instance in another objective-c class Jean-Daniel Dupas Jun 6, 17:24
mlRE: how to build c++ file and create its instance in anotherobjective-c class Kartik Ganesan Jun 6, 21:18