This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: dealing with built-in functions
Brian Dessent schrieb:
> Florian Gleixner wrote:
>
>> gcc r.c -lm
>> r.c: In function 'main':
>> r.c:9: warning: incompatible implicit declaration of built-in function
>> 'round'
>
> I'm assuming that your C library is glibc, i.e. you're using Linux. It
> is always a good idea to state what platform you are using, because gcc
> supports many dozens of platforms so don't assume we know what you're
> using.
>
Good guess. I will be more verbose next time.
> The problem you are seeing is that glibc has a number of feature levels
> that it supports. By default, it only exposes a fraction of available
> features (C90) in its headers. You have to explicitly define the level
> of feature support that you want:
> <http://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html>.
> Defining _GNU_SOURCE gets you everything and is the most commonly used,
> e.g. by adding -D_GNU_SOURCE to CFLAGS. I think that if you use
> autoconf, it takes care of this for you if it detects you're on a glibc
> system, but I could be wrong.
Autoconf did not help me here automatically. But maybe i have to change
something in configure.ac?
So what is the "right way"? Use -D_GNU_SOURCE while compiling or add a
#define? I decided to add the #define, and it works. Thank you for your
explanation and help!
Flo