delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/14/04:21:16

From: baudy AT videotron DOT ca (Benjamin Audy)
Newsgroups: comp.os.msdos.djgpp
Subject: Linking problem for me, too
Date: Mon, 13 Jan 1997 21:20:47 GMT
Organization: SPC
Lines: 31
Message-ID: <32da9f90.11450899@poste1>
NNTP-Posting-Host: ppp039.209.mque.videotron.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi!

When I link two files using gxx, it works fine:

"gxx test.cpp func.o -lc"

(it works even if I don't write "-lc").

But when I create a "test.o" file and try to link the two together
with "ld", it doesn't work.

First, I tried: "ld test.o func.o", but it gives me a list of
undefined references, who are some standard library functions I call
from test.cpp, (ie: malloc).

Then I tried: "ld test.o func.o -lc" and it returns:
"c:/djgpp/bin/ld.exe: cannot open -lc: File in wrong format", which
seems to be a bug, since I can write anything after the "-l" and it
will give the same result. It should have gave me a "no such file"
error, or something like that.

Finally, I tried: "ld test.o func.o -Lc:\djgpp\lib -lc" and it gives a
lot of undefined references to labels within the "libc.a" file (I
guess).

So I guess I need to include another file in the lib directory, but
which one? And why do I have to explicitly give all the library files,
unlike with gxx?



- Raw text -


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