You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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: 12
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
The text was updated successfully, but these errors were encountered:
Neat, will have a closer look at that weirdness when I can. Hopefully a solution can be found that won't require awkwardly redefining _DEFAULT_SOURCE everywhere.
What version of GCC and what specific OS are you using BTW?
On September 5, 2019 11:05:15 PM MDT, BareRose ***@***.***> wrote:
Neat, will have a closer look at that weirdness when I can. Hopefully a
solution can be found that won't require awkwardly redefining
`_DEFAULT_SOURCE` everywhere.
What version of GCC and what specific OS are you using BTW?
--
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#4 (comment)
GCC 7.4.0. But I'm not sure if this is a bug in GCC; it also fails with Clang. Clang does use GCC headers though, so maybe.
It compiles just fine with TCC, and I don't know where TCC's headers come from on Linux. TCC is more of a pure C compiler that I have a fondness for, but it has to work in GCC and Clang.
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.h
and it worked. Sources: 1 2When something like
stdio.h
is included, it doesn't work by simply putting the snippet in or directly above the#include
ofswrap.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
The text was updated successfully, but these errors were encountered: