Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How do I distribute a small C desktop app without compiling from source?

I wrote a small program in C using SDL2. I’m used to only writing tools for myself and building them on Linux systems, but a friend of mine asked if I could give him a copy for use on his Windows machine.

My program is built using cmake, and I could theoretically build it from source on his machine. However, I would really like to know how more professional people distribute their apps.

I imagine that it’s more involved than just compiling the program using gcc and then distributing the generated .exe file.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You asked how professional developers compile programs for Windows.

Typically, they will buy a Windows computer, or install Windows in a virtual machine (virtual computer). They will use that computer for compiling and testing on Windows, using the relevant Windows tools like Microsoft Visual C++.

Small open-source programmers who don’t have Windows and don’t want to buy it just for testing can will rely on some volunteer who already has Windows on their computer. If nobody volunteers, then it doesn’t get done. That’s the nature of open-source: if you want it and nobody else has done it, you have to do it yourself.

It’s possible to compile Windows programs on Linux*, so why is it important to have a Windows computer? It’s for testing. No matter how hard you try, there’s always going to be a chance that for some silly reason your program doesn’t work on a real Windows computer, so you need to try it and see. You wouldn’t write a Linux program, compile it and give it to someone else without running it for yourself first to make sure it works – and the same applies for Windows.

Every release of a professional product is thoroughly tested on every operating system where it’s supposed to work. For free and open source products, the expectations are much lower, and it’s quite common for the developer to not make a Windows version at all, or make it someone else’s problem – including the possibility of compiling one but not really caring whether it actually works or not. Therefore you may choose not to bother testing every version your program on Windows except when someone complains that it doesn’t work, if that’s what you want to do. However, I’d say it’s a bit pointless to compile one and then not test it even a single time as there’s a very high chance it won’t work. So you still need to test at least once.

* by installing a Windows compiler on Linux, e.g. see How to compile for Windows on Linux with gcc/g++?. Visual C++ will not work on Linux, but you can use the Windows version of gcc, called MinGW.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading