LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   GCC pre-compile directive indicating Linux or BSD (https://www.linuxquestions.org/questions/programming-9/gcc-pre-compile-directive-indicating-linux-or-bsd-4175646510/)

dogpatch 01-18-2019 09:23 PM

GCC pre-compile directive indicating Linux or BSD
 
Is there a pre-compile directive in GCC that will indicate whether it is compiling on a Linux system or BSD (or other) OS?

dogpatch 01-18-2019 10:03 PM

I think i've answered my own question.
Code:

#ifdef __linux__

ntubski 01-20-2019 03:00 PM

FYI, I think what you're talking about is called a preprocessor directive, not "pre-compile". From the title, I thought at first that you were asking about precompiled headers.

dogpatch 01-25-2019 10:18 AM

My lexicon stands corrected


All times are GMT -5. The time now is 03:30 PM.