gcc erreur : undefined reference to `ltid'

si je inclure stdlib.h puis aussi itoa() n'est pas reconnu. Mon code :

%{
#include "stdlib.h"
#include <stdio.h>
#include <math.h>
int yylex(void);
char p[10]="t",n1[10];
int n ='0';

%}
%union
{
char *dval;
}
%token ID
%left '+' '-'
%left '*' '/'
%nonassoc UMINUS
%type <dval> S
%type <dval> E
%%
S : ID '=' E {printf(" x = %sn",$$);}
;
E : ID {}
| E '+' E {n++;itoa(n,n1,10);printf(" %s = %s + %s ",p,$1,$3);strcpy($$,p);strcat($$,n1);}
| E '-' E {n++;itoa(n,n1,10);printf(" %s = %s – %s ",p,$1,$3);strcpy($$,p);strcat($$,n1);}
| E '*' E {n++;itoa(n,n1,10);printf(" %s = %s * %s ",p,$1,$3);strcpy($$,p);strcat($$,n1);}
| E '/' E {n++;itoa(n,n1,10);printf(" %s = %s /%s ",p,$1,$3);strcpy($$,p);strcat($$,n1);}
;
%%

main()
{
yyparse();
}

int yyerror (char *s)


{


}

Après avoir exécuté le code que j'ai :

gcc lex.yy.c y.tab.c -ll
12.y: In function yyparse’:
12.y:24: warning: incompatible implicit declaration of built-in function strcpy
12.y:24: warning: incompatible implicit declaration of built-in function strcat
12.y:25: warning: incompatible implicit declaration of built-in function strcpy
12.y:25: warning: incompatible implicit declaration of built-in function strcat
12.y:26: warning: incompatible implicit declaration of built-in function strcpy
12.y:26: warning: incompatible implicit declaration of built-in function strcat
12.y:27: warning: incompatible implicit declaration of built-in function strcpy
12.y:27: warning: incompatible implicit declaration of built-in function strcat
/tmp/ccl0kjje.o: In function `yyparse':
y.tab.c:(.text+0x33d): undefined reference to `itoa'
y.tab.c:(.text+0x3bc): undefined reference to `itoa'
y.tab.c:(.text+0x43b): undefined reference to `itoa'
y.tab.c:(.text+0x4b7): undefined reference to `itoa'

Où vais-je tort ? Pourquoi je ne peux pas trouver la référence à la ltid ? J'ai aussi essayé avec <> supports pour la ltid.

InformationsquelleAutor Anubha | 2012-10-19