There are other issues besides the GUI to consider when writing a portable program. First, stick with the programming language standard. Don't use proprietary extensions or rely on undefined behavior that happens to work on one system. Don't make assumptions about type sizes, endianess or data formats. This is all just good C programming. In practice you will also have to deal with possible bugs in various implementations of the compiler and libraries, but simply sticking to standardized C or C++ will help.
In addition to the functions included in the standard language libraries and in the GUI functionality itself, your cross-platform program will need to use portable versions of such things as directory structure access, threading, inter-process communications, database access, and networking. An example of a C++ library that provides these non-GUI system level features is ACE. Another reasonable solution is to use the standard Linux (POSIX) functions and then use a library such as Cygnus GNU-Win32 which implements most of the POSIX functionality on Windows 95 and NT.