https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90580
Bug ID: 90580 Summary: error: ‘offsetof’ undeclared when it is declared, but used with the wrong number of arguments Product: gcc Version: 8.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: slandden at gmail dot com Target Milestone: --- test2.c: In function ‘main’: test2.c:113:42: error: macro "offsetof" requires 2 arguments, but only 1 given 113 | printf("offsetof %u", offsetof(key.rounds)); | ^ In file included from test2.c:64: /usr/lib/gcc/powerpc64le-linux-gnu/9/include/stddef.h:406: note: macro "offsetof" defined here 406 | #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER) | test2.c:113:23: error: ‘offsetof’ undeclared (first use in this function) 113 | printf("offsetof %u", offsetof(key.rounds)); | ^~~~~~~~ test2.c:65:1: note: ‘offsetof’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’? 64 | #include <stddef.h> +++ |+#include <stddef.h> 65 | /* test2.c:113:23: note: each undeclared identifier is reported only once for each function it appears in 113 | printf("offsetof %u", offsetof(key.rounds)); | ^~~~~~~~