if


 
Thread Tools Search this Thread
Top Forums Programming if
# 1  
Old 12-12-2008
if

How I can include one head file if this program compiles on freeBSD and other if on the Linux platform.

#include <some.h>

I know that very often it does configure script, but can I do it directly in cpp code?
# 2  
Old 12-13-2008
Use the preprocessor provided conditional statements for that...
Code:
#if machine == freeBSD
     #define HDR "somefile.h"
#elif machine == Linux
     #define HDR "otherfile.h"
#else
     #define HDR "default.h"
#endif

#include HDR

Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question