I was having trouble getting swrap to compile in C99 mode with GCC, but then I put
#undef _DEFAULT_SOURCE
#define _DEFAULT_SOURCE 1
at the top of a .c file that #includes swrap.h and it worked. Sources: 1 2
When something like stdio.h is included, it doesn't work by simply putting the snippet in or directly above the #include of swrap.h. You have to put the snippet above all includes in the translation unit to be safe.
I have attached a test case. Try compiling it both ways.
swrap_c_test.zip
I was having trouble getting swrap to compile in C99 mode with GCC, but then I put
at the top of a .c file that #includes
swrap.hand it worked. Sources: 1 2When something like
stdio.his included, it doesn't work by simply putting the snippet in or directly above the#includeofswrap.h. You have to put the snippet above all includes in the translation unit to be safe.I have attached a test case. Try compiling it both ways.
swrap_c_test.zip