Search code examples
cstrdup

How to avoid including "-D_BSD_SOURCE" in compile statement every time the code is compiled?


To avoid a whole bunch of strdup errors, I have to always include -D_BSD_SOURCE in my compile statement. Is there a way I can somehow include this in my .c file and never include it in my compile statement again.


Solution

  • At the top of your .c file, before the includes, put this:

    #define _BSD_SOURCE