Are there any user friendly tools out there to cross-compile from Windows to Linux?
Manually port your code from Linux and compile for Windows using Microsoft C++ (MSVC). This involves refactoring platform-independent code into separate libraries, and then re-writing the Linux-specific code to use Windows-specific code (for example, Win32 or DirectX APIs).
GCC, a free software collection of compilers, can be set up to cross compile. It supports many platforms and languages. Cross-compiling GCC requires that a portion of the target platform's C standard library be available on the host platform.
crosstool-ng supports building cross-compilers with cygwin host.
Overview:
crosstool-ng
tar xvjf crosstool-ng*
)./configure
flex
, libtool
, ncurses-devel
) You'll need at least the following: make
make install
/usr/src/cross-linux-gnu-root
mount c:/cygwin/usr/src/cross-linux-gnu-root /usr/src/cross-linux-gnu -o binary,posix=1
)ct-ng menuconfig
x86
(probably) and subarchitecture to i686
(avoids GCC 4.8 issues, thanks osm0sis), target kernel to linux
, and target C library to glibc
, and enable the C++ compiler.Paths and misc options
then, go in Companion tools
(at top-level) and enable Build some companion tools
and then make 3.81
(Thanks osm0sis)ct-ng build
Of course, this is NOT going to enable you to build linux applications from inside Visual Studio. (VS2010 and later let you build with other toolchains such as gcc, but you'd need an appropriate toolchain description in addition to the cross-compiler built by crosstool-ng). But you'll have a working g++-linux-gnu
, which you can either run directly or using a Makefile.
NOTE: Building the cross-compiler takes a LONG time. osm0sis has provided a prebuilt gcc 4.8.1 here, along with his notes on building the cross-compiler (used to update this answer).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With