Unsolved Can I write one code for all platforms ?
-
Hi
Is it possible to write one code for all platforms ? it should run on desktop ( all OS ) and on mobile as well ( all OS ) ? -
@Ahti Yes, this is what Qt is for.
But if you want to support that many platforms (all Desktop, all mobile, what does - "all" even mean?) then you will need some platform specific code as well. -
hi @Ahti
yes it's possible with Qt to have one code base for all supported platforms.
However you have to do some differentiations between the OS's
Qt offers Macros for your source code( for example ) and your pro file for that purpose ( for example )
-
-
@Ahti Yes. But you will build you app for each supported platform. Qt is a C++ framework, that means your app is build for a platform as binary which directly runs on the CPU. This is a difference to Java. Java apps are build once for the JVM and run on all platforms where the JVM is available. Qt is "Code once build everywhere".
-
@jsulm Do I have to start my projects by select Qt Widgets Application for that purpose ?
and later on add the specific code ? -
@Ahti If you want to write a GUI application using widgets then yes. You should also consider using QML as it is better suited for mobile apps (and can be used for desktop apps as well).
-
For cross platform (desktop and mobile in this case) I would highly recommend using QML for your UI/frontend. As it comes with native GPU support. Very noticeable for mobile apps.
You can force that also via QWidgets, but you'll have to go the extra mile to set it up and use it.
-
-
@Ahti because no valid kits were found of course...
More information please, did you install the precompiled libs ? are they found, what warnings/errors do you have in your kits section of QtCreator options ?
-
@J.Hilk Here is my kits section configuration:
And I Just installed Qt 5.9 from its setup.
-
@Ahti
No, it seems like you only installed QtCreator and (maybe) the MinDW complier tool.You're missing any precompiled Qt Libs.
I would suggest opened the maintenanceTool and installing a Qt version from there (5.9.x the latest LTS or the latest 5.12) -
@J-Hilk What I can remember after installing Qt 5.9 I downloaded a new version of Qt Creator and replaced it with one already included with Qt 5.9 could that be the culprit also I tried update component of maintenanceTool but that gives me At least one valid and enable repository required for this action to succeed error. Would reinstalling Qt5.9 help ?
-
@Ahti You should really use online installer. Then you will have Qt Maintenance Tool which you can use to add/remove Qt versions, update Qt and QtCreator.
-
@jsulm Thanks for your time. But reinstalling helped :D
-
@jsulm Btw I still have Maintenance Tool with offline installer but its showing error with update components even after reinstalling.
-
@Ahti said in Can I write one code for all platforms ?:
offline installer
Theres' the problem
The offline installer does not allow for updates or later removals/addons.
You should use the online installer.The offline one is more of a last resort kind of deal, when the online one doesn't work at all ;-)