I have heard that a way to write Cross Platform c++ code is to define classes as follows (for example, a Window class):
window.h
window_win32.cpp
window_linux.cp
A common way to do this is to use polymorphism. You provide an interface that abstracts your functionality without any regard to a specific platform:
class thread
{
virtual ~thread() {}
virtual void run() = 0;
/* whatever */
};
and then you can inherit from this class using platform specific features:
class posix_thread : thread;
at compile time you choose with #ifdef
s what class you include and instantiate.