cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/13/09:57:48

Message-Id: <3.0.6.32.19990413095311.008a9510@iie.ufro.cl>
X-Sender: abecerra AT iie DOT ufro DOT cl
X-Mailer: QUALCOMM Windows Eudora Light Version 3.0.6 (32)
Date: Tue, 13 Apr 1999 09:53:11 -0300
To: djgpp AT delorie DOT com
From: Anita Lilian Becerra Lagos <abecerra AT iie DOT ufro DOT cl>
Subject: how compiling Objective-C
Mime-Version: 1.0
Reply-To: djgpp AT delorie DOT com

hi

I have a DJGPP
but a  can't  compiling a litle program

a try with

gcc -lobjc main.m printer.m -o test 

thanks


my program is :





main.m 


// This will create a Printer object, set it's string and tell it to print

#import "Printer.h"

void main()
{
   id printer = [[Printer alloc] init];
   [printer addStringValue:"Hello World!"];
   [printer print];
   [printer free];
}


Printer.h 


#import < objc/Object.h>


@interface Printer : Object
{
   char buffer[100];
}

- init;
- addStringValue:(const char*)astring;
- print;
- clear;

@end


Printer.m 


#import "Printer.h"

@implementation Printer 

- init
{
   [super init];
   [self clear];
   return self;
}

- addStringValue:(const char*)astring
{
   strcat(buffer, astring);
   return self;
}

- print
{
   printf("%s\n",buffer);
   [self clear];
   return self;
}

- clear
{
   strcpy(buffer, "");
   return self;
}

@end

PD: i get it from

http://www.slip.net/~dekorte/Objective-C/Documentation/5_SampleCode/SampleCo
de1.html
 



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019