Re: C++ and objective-c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thats old cake. Objective-C++ is exactly what you want. See?

— ObjC++
#include <iostream>
#import <Foundation/Foundation.h>

class DatValue {
	public:
	std::string oo;
};

@interface do_the : NSObject {}
+(void)talk:(std::string)that;
@end

@implementation do_the
+(void)talk:(std::string)that {
	std::cout << "I am supposed to say: " << that << std::endl;
}
@end

int main() {
	DatValue dv;
	dv.oo="Derp!";
	[do_the talk:dv.oo];
}
—

Note, this only works on Mac…the code, that is. I did not remember the exact contents of <objc/objc.h>, otherwise I would have just used the Gnu runtime. But basicaly, thats how it looks like. Make sure to save the file with .mm eding, and link to the runtime. I.e.:

	$ g++ derp.mm -o derp -lobjc

will do.
Am 30.04.2014 um 17:55 schrieb Steven Boyls <sboyls@xxxxxx>:

> I was reading on the gnustep site that soon gcc would be able to compile files that contained both objective-c and c++. 
> What is the status of this?
> When will it be implemented. 
> 
> Regards,
> 
> Steve
> 
> Sent from my iPhone






[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux