// global.h
#define MY_PLATFORM_WIN32 1
#define MY_PLATFORM_LINUX 2
// ====================================================
// Change here to compile for another platform
//#define PLATFORM MY_PLATFORM_LINUX
#define PLATFORM MY_PLATFORM_WIN32
// ============================================
#if PLATFORM == MY_PLATFORM_WIN32
#include <Windows.h>
[...]
#else
#include <stdio.h>
[...]
#endif
As seen, I have to change manually when switching development platforms. Of course, this isn't that bad.
I recon there could be an easy way to achieve this in an automated manner, tho. Any hints? Thanks.
"Yessir, I'll be happy to make these unnecessary changes to this irrelevant document." (Dilbert)
In my applications, I use something similer to the following; though I beleive Irrlicht also has a way to check if it is running in Linux, Windows or MacOSX. The defines for _WIN32 and _DEBUG are all part of the compiler so there is nothing special you need to do.
You could also do something like this in your main file to select if it should be a WinAPI main or just a normal one. I hope this gives you an idea of how else you can do this
AlexL wrote:In my applications, I use something similer to the following; though I beleive Irrlicht also has a way to check if it is running in Linux, Windows or MacOSX. The defines for _WIN32 and _DEBUG are all part of the compiler so there is nothing special you need to do.
You could also do something like this in your main file to select if it should be a WinAPI main or just a normal one. I hope this gives you an idea of how else you can do this
Yes, I am using Visual Studio .NET on Windows and GCC on Linux; though I have also used this with GCC on Windows through Dev-Cpp. So there's no problem there