Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write a cross-platform program?

Greetings,

I want to write a small cross-platform utility program with GUI in it. What language/GUI-library should I stick to? Is it possible whatsoever?

This is gonna be a small program, so I don't want to make people download JVM or .NET Framework. Is it possible to develop it natively?

Update 1.

By "natively" I mean that the end result will be native code without intermediate layers like Java Virtual Machine or .NET Common Language Runtime

Update 2.

A FREE solution is preferable ;)

like image 882
Pavel Bastov Avatar asked Sep 26 '08 11:09

Pavel Bastov


People also ask

How do you write a cross-platform program?

Using conditional compilation in C or C++, you can write a program that will use OS-specific features and simply compile differently on each platform. Of course in that case the effort can almost be the same as writing two applications.

What language is used for cross-platform?

To code cross-platform software, developers use intermediate programming languages — HTML, JavaScript and CSS — not native to devices and OSs.

What is cross-platform programming?

Cross-platform development is the practice of developing software products or services for multiple platforms or software environments. Engineers and developers use various methods to accommodate different operating systems or environments for one application or product.

What is cross-platform software example?

For example, a cross-platform application may run on Microsoft Windows, Linux, and macOS. Cross-platform software may run on many platforms, or as few as two. Some frameworks for cross-platform development are Codename One, Kivy, Qt, Flutter, NativeScript, Xamarin, Phonegap, Ionic, and React Native.


2 Answers

If you know C or C++ the first cross platform GUI framework I can think of are:

  • QT (C++, proprietary but free with the LGPL licensing)
  • wxWidgets (C++, the most complete and stable but also huge)
  • FLTK (C++)
  • FOX (C++)
  • IUP (C, simpler and cleaner than the ones above)

If you know Pascal, you can try freepascal+Lazarus. I've never used it, though.

like image 63
Remo.D Avatar answered Sep 27 '22 22:09

Remo.D


The problem is: If you do not want to have a GUI but you do not want to ask the user to download an eternal API, Framework or virtual machine to run it in, be it TCL/TK, Java or QT etc. then you get lost pretty fast.

The reason is: You would have to rebuild all the (GUI) functionality those APIs, frameworks and virtual machines provide you with to be platform independent. And that's a whole lot of work to do... .

On the other side: The Java virtual machine is installed on nearly any operating system from scratch, why not give this one a shot?

like image 36
Georgi Avatar answered Sep 27 '22 20:09

Georgi