You will have to recompile all libraries for different operating systems. Binary formats for libraries range from operating system to operating system. More importantly, even if you are not using libraries, you need to recompile them for the simple reason that different operating systems have different calling conventions. The only way around this is with the virtualizer.
In particular, CygWin cannot run Linux programs. at all. CygWin provides only the posix compatibility level between your program and the Windows kernel.
The situation is slightly worse on Linux. Wine can run native Windows code (without having to recompile anything, including source code). But Wine also has limitations. This is not a complete Windows API, and all that is required to run the library code must be available on Wine, otherwise it will not work. For many simple applications, this is not a serious problem, but many of the new Windows APIs, some dark corners of the older ones that do not see much use, and, in particular, everything related to the hardware will probably not be available.
If you intend to work on several platforms, it is very important to first make sure that the libraries you are going to use are also cross-platform or there are reasonable equivalents for all the operating systems that you want to use.
source share