Skip to content

Strange interaction with standard headers in C99 mode with GCC #4

@ghost

Description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions