Pro*C Compilarion Errors while using itoa() function. (Doc ID 1332963.1)

Last updated on OCTOBER 17, 2011

Applies to:

Precompilers - Version: 11.2.0.2 and later   [Release: 11.2 and later ]
Information in this document applies to any platform.

Goal

Compiling a Pro*C program (or an OCI program) which uses the itoa function failed with the following error:

Undefined first referenced
symbol in file
itoa test_itoa.o
ld: fatal: Symbol referencing errors. No output written to myApp

The following illustrates the issue.

Place the following code into a file named test_itoa.pc.

#include <stdio.h>
#include <stdlib.h>

int main () {
  int i;
  char str[33];

  printf ("Enter a number: ");
  scanf ("%d",&i);

  itoa (i,str,10);
  printf ("decimal: %s\n", str);

  itoa (i, str, 16);
  printf ("hexadecimal: %s\n", str);

  itoa (i, str, 2);
  printf ("binary: %s\n", str);

return 0;
}


Compile & Link
Although the issue is visible when building with either the Pro*C or OCI make file, just the standard
C build commands are used to illustrate the issue as there isn't any reference to Oracle in the above sample code.


[celcsol1]/tmp> cc -v -xarch=v9 -xchip=ultra3 -c test_itoa.c
"test_itoa.c", line 150: warning: implicitly declaring function to return int: itoa()

[celcsol1]/tmp> cc -xarch=v9 -o myApp test_itoa.o -lm -lthread
Undefined                   first referenced
symbol                         in file
itoa                         test_itoa.o
ld: fatal: Symbol referencing errors. No output written to myApp


Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms