Mail Archives: djgpp/1999/11/07/12:49:56
On Sat, 6 Nov 1999, Alexander Russell wrote:
> ld -Lc:\\djgpp\\lib c:\\djgpp\\lib\\crt0.o database.o crossw.o
> words.o -lm -lc -
> lgcc -o CROSSW.EXE
> c:\djgpp\lib/libgcc.a(_new_handler.o): In function `__default_new_handler':
> libgcc2.c(.text+0x4d): undefined reference to `write'
> make.exe: *** [CROSSW.EXE] Error 1
It is generally not recommended to call `ld' directly, because you can
easily miss the right arguments or their order and get errors. It is
much easier to invoke gcc for this.
If you absolutely MUST call `ld' directly, look at the file lib/specs for
the exact arguments gcc passes to it, and do the same. If you cannot
figure out the cryptic syntax of lib/specs, invoke gcc with -v on some
simple program and you will see how it invokes `ld'.
> Am I missing a lib in the link line?
One problem is that you miss the djgpp.djl linker script. Another
problem is that you need to say "-lgcc -lc -lgcc" (yes, -lgcc twice).
- Raw text -