There is a header file that I include that only seems to exist on Linux machines, and not on MacOS machines. Although I can use a VM to compile and run the code, it would be nice to be able to do this in MacOS.
To be more specific, I am using #include <endian.h>
, which compiles on Linux, and I would like to use this compatibility header for MacOS, which I would include with #include "endian.h"
. My code compiles and executes as expected with the former include on Linux machines, and with the latter include on MacOS machines.
Is there a way to use platform-specific includes in the header (perhaps using some sort of #if
-based syntax)? Or would this be bad practice?