You can write a C/C++ program for both system types by the use of include directives to define which sections should be included in on windoze systems and *nix systems.
The link that jonsagara listed for the gnu compiler is what you are looking for, you can get it integrated also if you get the cygwin environment (plus some excellent unix commands).
Also, as jon said, you can't compile it on one system and that executable run on the other, they are incompatable in that aspect. You have to compile the source code on the os type you wish to run it on. The other problem, especially if you are writting window style applications, they will not port over at all, unless you use something like the wxWindows library to build the program, which will port to either system, but you still have to compile it on the system you want to run it on.