osx - c++ #ifdef Mac OS X question -


i new c++. working on group project , want make our classes compatible both lab computers (windows) , computer (mac os x).

here have been putting @ top of our files:

#ifdef target_os_x #    include <glut/glut.h> #    include <opengl/opengl.h> #elif defined _win32 || defined _win64 #    include <gl\glut.h> #endif 

i realize question has been asked before searches have been giving me conflicting answers such "_mac", "target_mac_os", "macintosh", etc. current , correct declaration put in #ifdef statement make compatible mac? right not working.

thank you!

according this answer:

#ifdef __apple__     #include "targetconditionals.h"     #ifdef target_os_iphone          // ios     #elif target_iphone_simulator         // ios simulator     #elif target_os_mac         // other kinds of mac os     #else         // unsupported platform     #endif #endif 

so in short:

#ifdef __apple__     #include "targetconditionals.h"     #ifdef target_os_mac         #include <glut/glut.h>         #include <opengl/opengl.h>     #endif #elif defined _win32 || defined _win64     #include <gl\glut.h> #endif  

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -