implicit declaration of function ‘__sysconf’

Ian Lance Taylor iant@google.com
Sat May 21 06:29:00 GMT 2011


Kamaraju S Kusumanchi <raju.mailinglists@gmail.com> writes:

> This must be a trivial question. Consider the following test case
>
>
> debian_chroot:sid:kusumanchi:/home/625341/w2# cat test.c 
> #include <sys/user.h>
>
> void test (long int a);
>
> void test (long int a)
> {
>     a = NBPG;
> }
>
>
> debian_chroot:sid:kusumanchi:/home/625341/w2# gcc -c -Wall -Werror test.c
> test.c: In function ‘test’:
> test.c:7:5: error: implicit declaration of function ‘__sysconf’ [-
> Werror=implicit-function-declaration]
> cc1: all warnings being treated as errors
>
>
> What should I do to make this warning go away? I am trying to reduce the 
> testcase for http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=627273 and fix 
> the build failure. But no matter what I do, I am unable to eliminate the 
> warning.
>
> I tried inserting
> #include <unistd.h>
>
> but that did not help. Any other suggestions?

The warning, converted to an error due to -Werror, means that the macro
calls the function __sysconf, and that function is not declared.

Your test case works fine on my Ubuntu Lucid system.  To figure out what
is happening on your system, you need to look at the definition of NBPG.
I don't know why it is calling __sysconf rather than sysconf.  sysconf
is declared in <unistd.h>.  I don't know where __sysconf is declared.
You could try simply grepping in /usr/include.

Ian



More information about the Gcc-help mailing list