Re: Should compiler generate an error at the time of compiler?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've checked errno.h file and errno is the macros like in standart. I've just 
would like to know how to do that cross compiller will generate error as well 
during link stage, like in usuall gcc. And can I do it or not. Because when I 
execute this code for Xenon:
gcc -nptl main.c -o main
collect2: ld terminated with signal 11 [Segmentation fault]
Best regards
Sergey Samoylov
On Wednesday 22 September 2004 15:58, Ken Foskey wrote:
> On Wed, 2004-09-22 at 22:00, Sergey M. Samoylov wrote:
> > I have a code with mistake:
> >
> > extern int errno;
> > main()
> > {
> > 	printf("errno=%d",errno);
> > }
> > Why in any cross gcc compilers when it compiler, compiler will pass?
> >
> > Why compiler will not say me about any mistakes like:
> > : undefined reference to 'errno'
> >
> > It's just only in cross compiler in usuall compiler gcc-3.3.1 it's OK and
> > compiler generate the error.
>
> There is no actual error here.  you are defining an external variable
> that is errno that may or may not exist at link time.  I have a bit of
> legacy code and the link step fails not the compile step.
>
> If the cross compiler defines errno as a true external int (which is
> permissible under the standard) but of course it is not portable.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux