title: (C/C++) How to generate executable file that can run on both Windows and Linux?
body: <p>I'm new in programming. From what i know, a program that is compiled in Linux should not be able to run in Windows. So, if we want to run the same program in both platform, we need to compile the source code under both platform, and create 2 different executable files.</p>
  
  <p>Recently I am studying the source code of an open source, cross-platform Java GUI application. I'm surprised to find that the backend engine of that GUI application is a small executable file generated from C++ codes. No matter users use that application in Windows or Linux, the Java GUI will call the same executable file in the bin folder.</p>
  
  <p>I just want to know, how can that executable file run on both Windows and Linux?</p>
  
  <p>I'm also interested to create a cross-platform Java GUI application using a C++ program as the engine. That C++ program is only available for Linux only. I've been googling for a while and i found that I need to use Cygwin to port it to Windows. However, if i use Cygwin, i will end up having 2 different executable files.</p>
  
  <p>How can i combine the Windows executable file with the Linux executable file? Is it possible to generate a single executable file that can run on both platform?</p>
  
  <p>Thanks.</p>