delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/14/07:15:47

From: Marc De Scheemaecker <Marc DOT DeScheemaecker AT advalvas DOT be>
Newsgroups: comp.os.msdos.djgpp,comp.lang.objective-c
Subject: Re: please help me to compile an Objective-C program
Date: Thu, 13 Aug 1998 22:53:46 +0200
Organization: TVD - Cable Internet Access
Lines: 32
Message-ID: <35D3525A.21C46DC2@advalvas.be>
References: <35d25c2c DOT 9025265 AT news DOT neosoft DOT com>
NNTP-Posting-Host: 195.162.198.69
Mime-Version: 1.0
NNTP-Posting-Date: 13 Aug 1998 20:58:18 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Flatulator wrote:
> 
> Hi.  I'm new to Objective-C and I'm trying to compile this sample
> program.  I'm using DJGPP v2 to do it.  I did everything perfectly as
> far as I can tell and I got some "undefined reference" error messages.
> The files in question are main.m, Printer.m, and Printer.h.
> Here's what I'm typing to compile:
> gcc -c main.m (no problem)
> gcc -c Printer.m (no problem)
> gcc -lobjc main.o Printer.o (Problem occurs here)
> 
> Here are the error messages:
> 
> main.o(.text+0x31):main.m: undefined reference to `objc_get_class'
> main.o(.text+0x3c):main.m: undefined reference to `objc_msg_lookup'

You need to use gcc main.o Printer.o -lobjc
because main.o and Printer.o depend on libobjc.a 
(the same happens with X-Window: you need to use -lXt -lX11 instead of -lX11
-lXt)

Hope this helps,

Marc
--
Marc De Scheemaecker                         http://home.tvd.be/ws35321

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS d- s: a- C++++$ UL++++(+)$ P(+) L++>+++$ E$ W++$ N++ !o K w---$ !O !M-
    !V-- PS+++ PE+ Y PGP !t !5 !X R !tv-- b- DI++++ D+>++ G++ e++ h>++ !r z 
------END GEEK CODE BLOCK------

- Raw text -


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