Showing results for 
Search instead for 
Did you mean: 

Compile error with GCC when just including stdlib.h

Go to solution



I'm trying to compile some libraries under RT Linux 4.6.7-rt14-5.0.0f0. However, I get errors stemming from the libc6-dev package. I can narrow it down to this repro:


#include <stdlib.h>

(Yes!). When compiling this file like so



x86-nilrt-linux-gcc bits_time_h_test.c

I get the errors



In file included from /usr/include/sys/select.h:45:0,
                 from /usr/include/sys/types.h:219,
                 from /usr/include/stdlib.h:314,
                 from bits_time_h_test.c:1:
/usr/include/bits/time.h:30:8: error: redefinition of 'struct timeval'
 struct timeval
In file included from /usr/include/sys/types.h:132:0,
                 from /usr/include/stdlib.h:314,
                 from bits_time_h_test.c:1:
/usr/include/time.h:15:8: note: originally defined here
 struct timeval {

I'm using gcc version 5.3.0-r0.24, libc6-dev version 2.23-r0.128.



What am I doing wrong?


Edit: Solved it by re-installing libc6-dev

0 Kudos
Message 1 of 2
Accepted by Bob_Schor

Sorry for the error above, I actually re-installed linux-libc-headers-dev to fix the issue.

0 Kudos
Message 2 of 2