Mail Archives: djgpp/1996/04/02/19:54:02
Reply to message 8212579 from JABROWN AT UNIX. on 04/02/96 11:02AM
>gcc -lpc -Wall -pedantic junk.c -o junk
>
>... I get this error message:
>
>junk.c(.text+0xfd): undefined reference to 'getche'
ld links files in the order it finds them on the command line. When it sees
'-lpc' as the first command, it looks at the library, but doesn't link anything
because it doesn't have anything to link it to (it hasn't found your program
yet). To correct this, just put the link command at the END of the command
line, like so:
gcc -Wall -pedantic junk.c -o junk -lpc
Look in the INFO docs for 'gcc' and 'ld'. It tells you everything you need to
know about the differences between one-pass and two-pass linkers. I made
the same mistake a few times before I got it figured out.
John
- Raw text -