   #define's, #ifdef's, and nesting, oh my!
  I''m working on my engine, SolGE, finally.  I''m trying to use macros to do the initializing, such as:SGE_INIT(WIN32,640,480);The reason I want macros is because different platforms would do different functions.  Windows has to start in WinMain but Linux can start in Main(), etc. so I have to have the code called from outside any function, hence the need for macros.Problem, is that I would need to define things inside the init.  So how can i make a macro be multiple lines and some of those lines contain more defines and possibly more macros?Or, is there another way to do it?    </pre> // God.cvoid main() {WORLD Earth;LIFE People = Earth.CreateLife(HUMAN);GiveHope(&People);delete Earth;EvilCackle();}    
  something like:  void main(){#ifdef _WIN32#define x 32#endif #ifdef _UNIX #define x 64 #endif  } is this what you mean?Edited by - Nytegard on July 5, 2001 8:29:00 PM  ;  Why not have a function for init, like this:   void init( int width, int height ){  // do platform-independant init here}  Then, have:   #ifdef _WIN32int WINAPI WinMain( ... ){    // win32-only init stuff here    init( 640, 480 );}#else#ifdef _LINUX  // or whateverint main( ... ){    // linux-only init stuff here    init( 640, 480 );}#endif  // _LINUX#endif  // _WIN32  An even better way is to have the two entry points (WinMain and main) in separate files, and only compile/link them when you''re in the correct platform, i.e have a linux_main.cpp and a win32_main.cpp file.  If you''re in windows, then link the win32_main.cpp file.  If you''re in linux, link linux_main.cpp.    War Worlds - A 3D Real-Time Strategy game in development.  ;  I wanted to have a function of macro that you call to initialize the engine, window, screen, etc.  The problem was that if I had to call a function to init it then where would I call that from?  If i called it from main() then i cant use WinMain() if its windows can i?However, I found a decent GLUT tutorial and I''m using that now, since my engine is OpenGL based anyway.    // God.cvoid main() {WORLD Earth;LIFE People = Earth.CreateLife(HUMAN);GiveHope(&People);delete Earth;EvilCackle();}  