Develop windows applications on linux

Developing Windows applications on Linux? [closed]

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

  • g++ for compilation and cross-compilation.
  • CMake
  • WxWidgets
  • . for making windows installer packages
  • wine for testing of the windows version
  1. What are some free (or even better open source) installers for Windows that I might use to create the final package? It would help if the package could be prepared from Linux.
  2. Will Wine be enough to test the cross compiled version (after all the logic is tested in the Linux version)?
  3. Is this a good idea? 🙂

If you have a copy of Windows handy, running a VirtualBox instance of it couldn’t hurt for testing either.

For testing at least Virtual Box is good, of course the best is a Windows installation it self.. Try writing that app in Windows. I like linux my self. but if your Building for Windows. Programming in windows its the best you can do (for windows applications of course).

7 Answers 7

Check Qt too. It’s a very rich cross-platform framework.

As for installers I’d highly recommend WiX.

For testing it will be much better to use some kind of virtualization like Sun Microsystems’s VirtualBox. I believe you could use a trial version of Windows or Windows 7 RC, which is free to use until March 2010.

Qt sucks. Application written in Qt will definitely not look like Windows one and the licensing is not very good. One will have to pay for commercial license some big money to Qt supporting company. This will be the case for linking statically as well. So doing Qt application cross-platform where one needs to pay vs create a native looking application for free. You hopefully get the idea. 😉

First of all, yes it is a good idea. I have several projects where I maintain their Windows version in this way.

In any case, I suggest you test the final product on a Windows machine. If you have a license for Windows OS, you may use virtualization to do final tests.

I suggest using Autotools which has very good cross-compilation support and works «natively» with a cross-compiler.

Under Debian for example, running

./configure --host=i586-mingw32msvc 

This would create the correct cross-compilation makefile as if this was a Unix project.

In any case, I would recommend developing a cross-platform version and a time-to-time test native Windows version with Wine/Windows by cross-compiling them.

Is it a disadvantage that we won’t be able to use profilers? And more over if I understand correctly the optimization procedures vary considerably from one OS to other. How could I tackle this? Or is it better to get something working and bother about optimization at the final testing in Windows , as you have mentioned.

Читайте также:  Making an alias in linux

You imply that the applications are for Windows only and not cross-platform, in which case I think the answer to 3. — This is really not a good idea — trumps the rest.

The reason being you are going to have to extensively test the application under Windows anyway, either directly or in a virtual instance. That being so you’re better to develop under the target OS because you’re more likely to produce a better application — both from catching the bugs earlier and more thoroughly and ensuring your application ‘works’ for your users. I certainly wouldn’t trust just Wine.

I’m not a big fan of cross-platform widgets. Like Java applications you generally end up with something that doesn’t quite look right, and like the uncanny gap that can be enough to make your application smell bad to a large section of your users. Even at the slightly more abstract level, each OS’s applications have a slightly different feel as to how they work and you’ll most likely end up with a Windows application that feels like a, say, KDE one, which will again put your users off.

So yes, certainly possible to do this, but probably not the optimal approach from point of view of the quality of the end product. To do so will give yourself something of a handicap with what you produce and I’d say that’s likely to offset the convenience to you of using a Linux platform. Actually I’d be surprised if you manage even that because I’d bet you’ll spend more time messing around with the widgets trying to fine-tune them so they work right under real Windows than you’ll gain from using an unfamiliar Windows toolset.

Источник

Running Windows Forms on Linux with Mono

Although WinForms may be “dead”, it does have one trick up its sleeve that WPF doesn’t, and that is you can run WinForms apps on mono. Here’s a simple guide to running a Windows Forms application on Ubuntu

Step 1 — Install Mono

Open a terminal window, and make sure everything is up to date with the following commands:

Now you can install mono with the following command:

Step 2 — Create an Application

Now we need to create our C# source file. You can use any text editor you like, but if like me you aren’t familiar with Linux text editors like vi or emacs, gedit is a simple notepad-like application which is easy to use. Launch it with the following command: (the ampersand at the end tells the terminal not to wait for gedit to close before letting us continue)

Now let’s create a very simple application:

Читайте также:  Rt3290 драйвер linux mint

Step 3 — Compile and Run

Now we’re ready to compile. The C# compiler in mono is gmcs. We’ll need to tell it we’re referencing the Windows Forms DLL:

To run the application, simply call mono, passing in the executable:

And that’s all there is to it! We have a WinForms app running on Linux.

Although mono doesn’t support everything in WinForms, you can use most standard controls, so you can easily add further UI elements:

Taking it Further

Obviously writing applications by hand like this is a bit cumbersome, but there is an IDE you can use for Linux called monodevelop. You install it like this:

This then gives you a nice editing environment, allowing you to debug, and manage project references (you’d usually add System.Windows.Forms and System.Drawing). Unfortunately it doesn’t offer a WinForms designer – for desktop apps it prefers you to use GTK#. Nevertheless, it’s a nice free IDE allowing you to experiment with getting your existing Windows Forms applications working cross-platform on Linux. (It seems this will also work on OS X with mono installed but I don’t have a Mac so I haven’t tried it out)

Want to learn more about Windows Forms? Be sure to check out my Pluralsight course Windows Forms Best Practices.

Comments

Comment by Bahawal TV

Can I run an existing application developed using deveX gui components?
That will be great if I can do that.

About Mark Heath

Microsoft MVP

I’m a Microsoft MVP and software developer based in Southampton, England, currently working as a Software Architect for NICE Systems. I create courses for Pluralsight and am the author of several open source libraries. I currently specialize in architecting Azure based systems and audio programming. You can find me on:

Search this site

Keep Updated

My Pluralsight Courses

  • Microservices Fundamentals
  • LINQ Best Practices
  • Microsoft Azure Developer: Deploying and Managing Containers
  • Azure Functions Fundamentals
  • Azure Durable Functions Fundamentals
  • Microservices Architecture: Executive Briefing
  • Building Microservices
  • Dapr 1 Fundamentals
  • Create Serverless Functions
  • More Effective LINQ
  • Versioning and Evolving Microservices in ASP.NET Core
  • Microsoft Azure Developer: Implement Azure Functions (AZ-204)
  • Azure Container Instances: Getting Started
  • Building Serverless Applications in Azure
  • Azure CLI: Getting Started
  • Understanding and Eliminating Technical Debt
  • Windows Forms Best Practices
  • Digital Audio Fundamentals
  • UWP Audio Fundamentals
  • Audio Programming with NAudio
  • Understanding Distributed Version Control Systems
  • Creating Modern WPF Applications with MahApps.Metro
  • Creating and Selling a Digital Product
  • ClickOnce Deployment Fundamentals

My Open Source Software

  • NAudio
  • NLayer
  • NAudio.Sharp Media Foundation
  • WaveForm Renderer
  • WPF WaveForm
  • TypeScript Tetris
  • Skype Voice Changer
  • MIDI File Mapper
  • MIDI File Splitter
  • SilverNibbles
  • Asterisk
  • WPF Shapes
  • .NET Voice Recorder

Archives

Tags

  • Azure (150)
  • NAudio (100)
  • Advent of Code (81)
  • LINQ (79)
  • F# (70)
  • Azure Functions (67)
  • C# (63)
  • Azure CLI (45)
  • WPF (39)
  • audio (38)
  • XAML (38)
  • JavaScript (36)
  • Silverlight (34)
  • Pluralsight (27)
  • Docker (26)
  • MoreLINQ (26)
  • Durable Functions (25)
  • Azure Blob Storage (20)
  • Azure Service Bus (17)
  • Azure Container Instances (15)
Читайте также:  Get pressed key linux

Источник

Ways To Develop Windows Apps On Linux

​Have you ever had the desire to develop Windows software or test it on your Linux system? Maybe because it is the most popular OS or due to the fact that your schools and institutions deploy only Windows OS in computer laboratories.

Well lucky you, there are two ways to actually develop or test Windows software on Linux system with the exception of dual booting (otherwise the article would have diverted away from the topic’s intention) Windows OS along with your existing system. Read on below to learn what are the two ways, moreover, I’ll also provide some additional insights from my experience for each option.

On WINE

wine hq linux emulator

WINE used to be an acronym for Wine Is Not an Emulator but now we’d just call it wine (pronounced like a drink).WINE’s website has a database listing all the applications that work under it. You might not find your preferred software on the list but don’t hesitate to try it out on WINE. Some 6 months back when I was learning to code data structures and object-oriented programs, I tried installing CodeBlocks 16.04 (which was not on the database list) and was amazed that my development platform works. Then I didn’t have to worry about my Linux GCC program failing to compile Windows specific library files,

​However, WINE tends to be buggy because there is some stuff that needs to be done alternatively in a quite bizarre way. For instance, though CodeBlocks 16.04 was successfully set up on my Linux system, there was no way I could make the cmd program launch to see my program’s output. Instead, what I had to do was launch CodeBlocks on command prompt first and then switch back to it when I run my program to see the output. Quirky and bizarre right?

Through virtualization

Linux virtualization virtualbox

​Using virtualization software is another way for either developing or testing Windows software on your Linux computer.​Use virtualization as your last approach if WINE doesn’t work for you. Because the former would demand more resources on your computer than the latter.

There are certain programs that won’t even work on WINE at all. An example includes the WinBGI libraries on CodeBlocks. Moreover, virtualization is the best approach if you really want to see your program running on an actual Windows environment.

Conclusion

​You can use either one of the above two methods for developing or testing your Windows software, and hopefully, you might prefer one over the other. WINE runs Windows software natively on Linux while virtualization pretty much simulates physical hardware and therefore guarantees you get more realistic output for your programs. Liked the article? Share it with your buddies and please don’t hesitate to share your opinions too in the comment section below.

Источник

Оцените статью
Adblock
detector