delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/19/13:17:45

From: Richard Lanyon <rlanyon AT plato DOT wadham DOT ox DOT ac DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Undefined reference to `main'
Date: Sun, 19 Jul 1998 17:42:50 +0100
Organization: Oxford University
Lines: 40
Message-ID: <Pine.LNX.3.95.980719173548.17348A-100000@plato.wadham.ox.ac.uk>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 980719192720 DOT 1303B-100000 AT is>
NNTP-Posting-Host: plato.wadham.ox.ac.uk
Mime-Version: 1.0
In-Reply-To: <Pine.SUN.3.91.980719192720.1303B-100000@is>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Sun, 19 Jul 1998, Eli Zaretskii wrote:
> On Sun, 19 Jul 1998, Richard Lanyon wrote:

> > > In which object file (of the two you are linking) is `main' defined?

> > dsweep.o

> What was the exact GCC command used to compile dsweep.o?

gcc -Wall -c dsweep.c
(well, actually it's gcc $(FLAGS) -c $*.c, where the make target is
dsweep.o and FLAGS is -Wall)

> > > And why did you need those -L switches?

> > I'm trying to get my program to talk to a piece of hardware that's
> > connected to my computer. The libraries are provided by the hardware
> > manufacturer (TDT, hence they're in c:\tdt\...).

> But you aren't actually linking in any libraries from there, since there 
> are no -l switches on the GCC command line that you posted.  So, at least 
> in this case, those -L switches are redundant.

Aaaaaah! Good point - this explains something else that confused me. If I
ran the linker from the command line instead of via make, it didn't
complain about main being undefined, but /did/ complain about loads of the
hardware-specific functions being undefined.

Which leads to two questions:

i) how do I link to libraries if they aren't called lib??.o (or lib??.so).
Can I just rename them (they're libraries compiled using Borland Turbo
Pascal 2.0)? 

ii) why is make behaving so strangely?

Richard
love myself better than you
know it's wrong, what shall I do?

- Raw text -


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