Mail Archives: djgpp/1994/11/26/07:27:55
A newbie question: I wonder if anyone can help?
I have DJGPP 1.12m2. I have been trying, with no success, to use it to
compile Objective-C. This is what happens when I try to compile and link
my trivial program:
C:\> gcc -c eg1.m
C:\> gcc -o eg1 eg1.o -lobjc
eg1.m(.ctor+0x0): undefined reference to `global constructors keyed to main'
object.m(.ctor+0x0): undefined reference to `global constructors keyed to
object.m'
I get a similar result for all Obj-C examples I have tried. Test 16
fails for the same reason. All the other tests pass, and DJGPP seems to
work fine for C and C++.
Any suggestions would be greatly appreciated.
(My trivial program is attached below. I think it is correct, but it
*is* the first I have ever written in Obj-C, so please forgive some
errors in style)
Thanks in advance.
--
David Monksfield <drm AT myob DOT demon DOT co DOT uk>
========================== CUT HERE ==========================
#include "stdio.h"
#include "objc/Object.h"
@interface TestObj : Object
{
int TestValue;
}
+ new;
- set: (int) NewValue;
- (int) get;
@end
@implementation TestObj
+ new
{
id TempObj;
TempObj = [super new];
[TempObj set: 0];
return TempObj;
}
- set: (int) NewValue
{
TestValue = NewValue;
}
- (int) get
{
return TestValue;
}
@end
int
main (void)
{
id a, b, c;
a = [TestObj new];
b = [TestObj new];
c = [TestObj new];
[a set: 1];
[b set: 99];
printf ("Values %d, %d, %d\n", [a get], [b get], [c get]);
}
========================== CUT HERE ==========================
- Raw text -