[ELDK] error: 'errno' undeclared
Stefano Babic
sbabic at denx.de
Tue Sep 21 18:25:11 CEST 2010
Alberto Ciampini wrote:
> hi!!
Hi Alberto,
> i have a strange issue when cross compiling for arm: if i try to use
> errno (or build programs that uses it), i get (for example):
>
> cmem.c:116: error: 'errno' undeclared (first use in this function)
> cmem.c:116: error: (Each undeclared identifier is reported only once
> cmem.c:116: error: for each function it appears in.)
I cannot confirm this issue, I can compile clean for ARM (you miss to
say which version of ELDK you are using. Let's say, we are using ELDK-4.2).
>
> and of course i have not forgotten to #include <errno.h>
> what puzzles me is that the errno.h file (eldk/arm/usr/include/errno.h)
> only includes <asm-generic/errno.h> and that file is just a list of
> defines....
> i also looked at the files in the include path, but it seems that the
> errno variable is not defined anywhere....
The errno should be in the libc, and in the include path you find the
extern reference.
>
> i tried to download the whole mailing list archives and look for a
> similar problem, but i found nothing...
Because there is no problem...it seems it is related to your environment.
This simple code as test can be compiled for ARM:
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
int main(int argc, char **argv)
{
int fd;
fd = open("test",O_RDWR);
if (!fd) {
printf("errno test: error %d\n", errno);
}
exit(0);
}
$ arm-linux-gcc -Wall -o testerrno test.c
$ file testerrno
testerrno: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically
linked (uses shared libs), for GNU/Linux 2.6.14, not stripped
> can you please try to give me some hints?? thanks a lot!!
>
Have you set the CROSS_COMPILE variable ?
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
More information about the eldk
mailing list