discuss-gnustep
[Top][All Lists]
Advanced

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

Re: objc++ test code


From: Björn Giesler
Subject: Re: objc++ test code
Date: Sat, 22 Jan 2005 09:18:57 +0100

Hi,

Am 22.01.2005 um 04:34 schrieb Rogelio M.Serrano Jr.:
Can anyone say if this is correct?

Almost :-)

[snip]
#include <iostream>
#include <Foundation/Foundation.h>

class myClass
{
public:
     int methoda();
};


@interface myobjcClass: NSObject
{
     int myVar;
}
+(int)hello;
@end

@implementation myobjcClass
+(int)hello
{
     return 1;
}
@end

myobjcClass * objcClass;

int
myClass::methoda()
{
     int var;

     var = [myobjcClass hello];
     std::cout << var << std::endl;
     return var;
}

int main(int argc, char **argv)
{
        int var = myClass().methoda();
        return var;
}
[snip]

This compiles on my Mac with the compiler line

        gcc -ObjC++ -o test test.m -lobjc -lstdc++ -framework Cocoa

and works as expected.

Regards,
Björn
--
Dipl.-Inform. Björn Giesler <giesler@ira.uka.de>
Web: http://wwwiaim.ira.uka.de/users/giesler
Tel: +49-721-608-8308 Fax: +49-721-608-8270
Key: http://wwwiaim.ira.uka.de/users/giesler/bg.asc
Augmented Reality, 3D User Interfaces, Machine Vision, Robotics

Attachment: PGP.sig
Description: Signierter Teil der Nachricht


reply via email to

[Prev in Thread] Current Thread [Next in Thread]