This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

getchar Linker error

I am new to programming microcontrollers, and I am just trying to write a simple program that echos back the characters to the screen. I first started off by trying to read from the serial port but then got this error:

*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
SYMBOL: getchar?T
MODULE: C:\KEIL\ARM\LIB\CAL.LIB (getchar)
DEFINED: .\XFLASH\Serial.obj (Serial)

I am just using the defualt function from one of the demos:

int getchar (void)  {                    /* Read character from Serial Port   */

  while (!(U0LSR & 0x01));

  return (U0RBR);
}


In main I have the following just to see if I can read in a char:


char c='0';
int argsread =0;

while (1) {
printf ("Enter a byte\n");/
argsread = scanf("%bd",&c);
printf("Arguments read: %d\n",argsread);


  }

I tried to look up the linker error, but the SW did not have any help ability for the linker. I know it is having conflicts with the getchar defined in the cal.lib, but it does not give me this error for the putchar function. So I don't know whats going on.

Can anyone help?

Thanks