Date: Sun, 7 Nov 1999 17:38:41 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Alexander Russell cc: djgpp AT delorie DOT com Subject: Re: link error, undefined reference to `write' In-Reply-To: <941922425.476047@neptune.uniserve.ca> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk 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).