Important: Please read the Qt Code of Conduct -

Qt cross platform? How does it work?

  • Hi guys,

    I've tried reading and googling a little, but either im searching it wrongly or it's too simple that's why no one posts this. But how exactly does one use Qt to cross platform? For example if i'm coding a program for windows, by using Qt i can allow my program to work on Linux as well? Or am i wrong? And if so, how exactly do i use Qt to allow my program to cross platform?

    Sorry i am really new to all these. It'd be nice if someone could explain it to me briefly or if there's some simple example.

    Thank you all so much >_<

  • You have to recompile your code for each platform you want to deploy on. To get your Windows Qt app to work in Linux, download and setup your Qt SDK environment under Linux and then use it to compile your Qt project. It should give you a Linux executable. The same goes for OSX (you need to setup a Qt build environment in OSX in order to generate a Mac app).

    Generating a single executable that runs on all devices is not possible. But you can generate binaries for any supported platform from the same code base.

    Try installing Qt on various platforms and then compile the sample apps. They are all using the same code but the output (executable binaries) are all specific to that particular OS.

    If you want to compile a Linux version of your app from a Windows development environment, do a search for "cross compiling". I've never done it, so maybe a more experienced person could help you.

  • I see, that's pretty detailed.. Thank you very much. I'll try to read more about it, thanks =]

Log in to reply