www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/04/02/11:09:39

Message-Id: <199604021626.IAA17080@unix.infoserve.net>
Mime-Version: 1.0
Date: Tue, 02 Apr 1996 08:02:49 -0800
To: djgpp AT delorie DOT com
From: John Brown <jabrown AT unix DOT infoserve DOT net>
Subject: ERROR MSG: junk.c(.text+0xfd): undefined reference to 'getche'

(Newbee question: sorry if its been asked a thousand times before...)

When compile the simple bit of code below using this command line:

gcc -lpc -Wall -pedantic junk.c -o junk

... I get this error message:

junk.c(.text+0xfd): undefined reference to 'getche'

As far as I am aware: 'getche' is in the libpc.a library and the -lpc switch
should instruct to linker (via the compiler) to search that library.

Is this a command line error, or is something wrong with my library? I am
fairly sure there is nothing wrong with my C program, but since I am new at
this I guess it is also a real possibility! Any help will be greatly
appreciated.

John


#include <stdio.h>
#include <conio.h>

void main(void);

void main(void)
{
int buffer;
char string[100];
char *ps;

  ps=string;

  do
  {
    buffer=getche();
    ps++;
    *ps=buffer;
  }
  while (buffer!='\n');
  *string='\0';
}

----------------------------------------------------------------------
 John Brown:   jabrown AT unix DOT infoserve DOT net          Lotus  /\
 List owner:   Approach Users Mailing List               /--\pproach
 To subscribe: send "SUBSCRIBE APPROACH"          relational database
              to MAISER AT rmgate DOT pop DOT indiana DOT edu     help & discussion
----------------------------------------------------------------------


- Raw text -


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