http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53981
Bug #: 53981
Summary: gcc.dg/20020201-1.c fails with Android NDK
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: testsuite
AssignedTo: [email protected]
ReportedBy: [email protected]
Created attachment 27803
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27803
Proposed fix
Hi,
when I compile gcc.dg/20020201-1.c with android ndk gcc (4.4 or 4.6) I get the
following error:
/tmp/ccK41Qjx.o: In function `doit':
20020201-1.c:(.text+0x43): undefined reference to `srand'
20020201-1.c:(.text+0x48): undefined reference to `rand'
20020201-1.c:(.text+0x55): undefined reference to `rand'
collect2: ld returned 1 exit status
In srand man it is stated that you need to include stdlib.h for (s)rand.
Adding #include <stdlib.h> fixes the issue.
Thanks,
Anna