Here is the minimal C program to reproduce:
#include <alsa/asoundlib.h>
#include <sys/time.h>
int main( void )
{
}
This will compile with gcc -c -o timealsa.o timealsa.c
, but if you include the -std=c99
switch, you get a redefinition error:
In file included from /usr/include/sys/time.h:28:0,
from timealsa.c:3:
/usr/include/bits/time.h:30:8: error: redefinition of ‘struct timeval’
struct timeval
^
In file included from /usr/include/alsa/asoundlib.h:49:0,
from timealsa.c:2:
/usr/include/alsa/global.h:138:8: note: originally defined here
struct timeval {
^
How can I resolve this conflict while still using -std=c99
?
return 0
is implicit if not present in C99 (Whcih this question is tagged with). See: https://mcmap.net/q/544503/-why-is-return-0-optional . The void is a problem though – Pettawayreaching the } that terminates the main function returns a value of 0
, but we are submarining here into an unrelated issue :) – Uncivilreturn 0
it is implied. This isn't the case for C89/C90 . – Pettawaymain()
shouldn't be "special". But indeed, this is completely unrelated here. And btw,int main(void)
is fine, too. – Matteson