Question

I've read that mingw can be used on Linux to build a windows executable from C/C++.

Can other languages do this, and how about popular GUI libraries?

In particular I'm interested in OCaml and Haskell as languages and libSDL, wxWdgets, and GTK as libraries.

Was it helpful?

Solution

It doesn't matter whether the language has support - what matters is the compiler (unless you're using a WORA language like Java). To answer your question, it is possible to build a cross compiler on Linux to target the Windows platform. SDL, wxWidgets, and GTK all have Windows versions to my knowledge, but you have to compile them with a compiler targeting Windows to be able to get object code that can run.

Cross compiling is very messy because you need to have one copy of a library of each architecture and platform that you want to target, and they all have to be installed in different places, so you need to play with linker flags a lot.

Here's a blog post explaining how to get a GCC distribution for Linux targeting Windows. And regarding Haskell and OCaml, sadly I'm not knowledgable in these areas, but the general case will hold true.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top