1,105,625 Community Members

Windows development in Linux?

Member Avatar
Basteon
Newbie Poster
22 posts since Dec 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

Is it possible to develop Win32 C++ applications under a Linux distribution? If it is then how do I do this?

I know about Virtual machines, but I'm looking for something that wouldn't require to emulate a whole OS.

Member Avatar
rubberman
Senior Poster
3,999 posts since Mar 2010
Reputation Points: 513 [?]
Q&As Helped to Solve: 501 [?]
Skill Endorsements: 87 [?]
 
0
 

Windows does support the POSIX interfaces, but writing code that works equally on Windows as on Unix is not simple, especially if you want to write GUI applications. In such a case, you would be best served by using a platform neutral SDK such as Qt. That provides a means to write C++ code that will run on any number of different operating systems without recoding - just recompilation.

Member Avatar
JasonHippy
Practically a Posting Shark
898 posts since Jan 2009
Reputation Points: 648 [?]
Q&As Helped to Solve: 164 [?]
Skill Endorsements: 8 [?]
 
0
 

I have heard that it is possible to set up a cross-compiler environment which will allow you to build executables for other platforms from within Linux, but I've never looked into it. The few cross-platform apps I've worked on have been done as per Rubbermans post.
e.g.
Using cross-platform libraries like QT or wxWidgets, separating any platform specific (or even compiler specific) code using #ifdef statements and using the preprocessor to perform conditional compilation. Then when it came to building the apps on different target platforms, it was a case of compiling the code in the targets native environment using a supported compiler.

I think google might be your friend here.
Here are a few links I found on the topic...
About cross-compilation:
http://en.wikipedia.org/wiki/Cross_compiler#GCC_and_cross_compilation
Cross-compiling wxWidgets for Windows on Linux:
http://wiki.wxwidgets.org/Cross-Compiling_Under_Linux#Cross-compiling_under_Linux_for_MS_Windows
MinGW as a cross compiler on Linux:
http://www.mingw.org/wiki/LinuxCrossMinGW

From an initial glance it looks like it'll be a bit of a pain to set up and get working. Good luck!

Question Answered as of 2 Years Ago by JasonHippy and rubberman
Member Avatar
Basteon
Newbie Poster
22 posts since Dec 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

Thank you, mates! I think Qt will work for me.

Member Avatar
jmichae3
Junior Poster
118 posts since Jul 2011
Reputation Points: -1 [?]
Q&As Helped to Solve: 14 [?]
Skill Endorsements: 0 [?]
 
0
 

I have heard that it is possible to set up a cross-compiler environment which will allow you to build executables for other platforms from within Linux, but I've never looked into it. The few cross-platform apps I've worked on have been done as per Rubbermans post.
e.g.
Using cross-platform libraries like QT or wxWidgets, separating any platform specific (or even compiler specific) code using #ifdef statements and using the preprocessor to perform conditional compilation. Then when it came to building the apps on different target platforms, it was a case of compiling the code in the targets native environment using a supported compiler.

I think google might be your friend here.
Here are a few links I found on the topic...
About cross-compilation:
http://en.wikipedia.org/wiki/Cross_compiler#GCC_and_cross_compilation
Cross-compiling wxWidgets for Windows on Linux:
http://wiki.wxwidgets.org/Cross-Compiling_Under_Linux#Cross-compiling_under_Linux_for_MS_Windows
MinGW as a cross compiler on Linux:
http://www.mingw.org/wiki/LinuxCrossMinGW

From an initial glance it looks like it'll be a bit of a pain to set up and get working. Good luck!

mingw I believe has compilers for
mac to mac (both 32 and 64-bit host-to-target),
windows-32 host to freebad target,
windows-32 host to ubuntu target,
windows-32 host to windows-32 target
windows-32 host to windows-64 target
windows-64 host to windows-64 target

and these are the ones that I know about. there are a number of flavors of windows compilers, including personal builds.
the windows hosted programs require the cmd shell, which linux does not have.

cygwin build environment can be used on windows for porting *nix software to windows, but it runs on windows, and has its own BASH. it has a fair number of linux utilities, it makes a massive build environment and you can spend an entire day downloading it all if you want.

I don't know of any cross-compilers that host on linux and compile for windows. I don't think that has been proposed on mingw-w64 users mailing list yet, but it would be interesting to see of someone does it. I can suggest it.

mingw and mingw-w64 both require microsoft's msvcrt.dll to work.
they do NOT generate standalone code.
this DLL is providedwith the OS, however, the DLL's list of functions change with time. for instance, using _ftelli64() or _fseeki64() will cause an error on windows 9x/me, since a 64-bit filesystem was not invented at that time. that was invented later when NTFS came along.

Member Avatar
jbennet
Moderator
17,127 posts since Apr 2005
Reputation Points: 1,618 [?]
Q&As Helped to Solve: 736 [?]
Skill Endorsements: 38 [?]
Team Colleague
Featured
 
0
 

Fedora has a win32 cross compiler that uses mingw and wine.

You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: