[Bug 677232] New: gcc: undefined reference to `lrintf'
https://bugzilla.novell.com/show_bug.cgi?id=677232 https://bugzilla.novell.com/show_bug.cgi?id=677232#c0 Summary: gcc: undefined reference to `lrintf' Classification: openSUSE Product: openSUSE 11.4 Version: RC 2 Platform: i686 OS/Version: SuSE Other Status: NEW Severity: Normal Priority: P5 - None Component: Development AssignedTo: pth@novell.com ReportedBy: helbert2a@gmail.com QAContact: qa@suse.de Found By: --- Blocker: --- User-Agent: Mozilla/5.0 (X11; Linux i686; rv:2.0b11) Gecko/20110203 Firefox/4.0b11 According to the glibc manual lrintf is defined by the math.h library, so gcc should compile this program successfully: #include<stdio.h> #include<math.h> #define NUM 3.0087F int main (void) { float num = NUM; int inum; inum = lrintf (num); printf ("%d\n",inum); return 0; } But I'm getting this error: linux@linux:~/Documents/Bugs/Glibc> gcc -g -o test-glibc test-glibc.c /tmp/cchvqfeh.o: In function `main': /home/linux/Documents/Bugs/Glibc/test-glibc.c:11: undefined reference to `lrintf' collect2: ld returned 1 exit status My system: openSUSE 11.4 RC2 GNOME i586 DVD installation. Thanks. Reproducible: Always Steps to Reproduce: 1. 2. 3. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=677232 https://bugzilla.novell.com/show_bug.cgi?id=677232#c1 Bernhard Wiedemann <bwiedemann@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bwiedemann@novell.com Resolution| |INVALID --- Comment #1 from Bernhard Wiedemann <bwiedemann@novell.com> 2011-03-06 11:46:07 CET --- you need to link with the math library: gcc -lm -g -o test-glibc test-glibc.c worked here and produced output "3" if you look carefully at your error message, you will notice that "ld" (the linker) produced the error, so the code could be compiled, but not linked. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=677232 https://bugzilla.novell.com/show_bug.cgi?id=677232#c2 --- Comment #2 from Edwin Aponte <helbert2a@gmail.com> 2011-03-06 18:28:57 UTC --- OK, thanks. Sorry. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com