From: Richard Lanyon 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: References: NNTP-Posting-Host: plato.wadham.ox.ac.uk Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII In-Reply-To: To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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?