Click to See Complete Forum and Search --> : if !defined( _WIN32 )


stt_d31
March 12th, 2008, 07:32 AM
i have a problem:
my code was mostly compiled on unix machines.
now we want to compile it on windows machines.
However, we have a first problem: unistd.h seems not to be available via visual studio/windows.

So I put that include-statement within the following #if-block:

#if !defined( _WIN32 )
#include <unistd.h>
#endif

Is this the best i could have done in this case?

thank you

stephendoyle75
March 12th, 2008, 08:38 AM
Yes, the standard approach is to wrap platform specific includes in Preprocessor #if / #else blocks.