Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Cross Platform Development

Cross Platform Development

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 2.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    krackerjax
    wrote on last edited by
    #1

    I've read through the forums and my apologies if I've missed this. My goal is to develop a cross-platform app for Windows and Linux. I know that in order to compile for Linux I must do so under the QT version for Linux. My question is in regards to development of the app.

    If I develop the app under QT for Windows and save it as a QT project file can I open that QT project file under QT for Linux and compile under Linux to make the Linux version of the app? Or do I have to develop the Linux version of the app from scratch under QT for Linux?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Code_ReaQtor
      wrote on last edited by
      #2

      [quote author="krackerjax" date="1367363366"]I've read through the forums and my apologies if I've missed this. My goal is to develop a cross-platform app for Windows and Linux. I know that in order to compile for Linux I must do so under the QT version for Linux. My question is in regards to development of the app.

      If I develop the app under QT for Windows and save it as a QT project file can I open that QT project file under QT for Linux and compile under Linux to make the Linux version of the app? Or do I have to develop the Linux version of the app from scratch under QT for Linux?[/quote]

      The answer is simple: "Code once, compile anywhere." Which means that you don't need to start again from scratch or do some revisions (but there are times you have to do some minor revision like platform-specific stuff).

      And by the way, it is "Qt" and NOT "QT"(QuickTime). There is a very big difference between the m.

      Please visit my open-source projects at https://github.com/Code-ReaQtor.

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tobias.hunger
        wrote on last edited by
        #3

        In theory you just need to develop your project on either Linux or Windows and then build it once for the other platform once you are done developing. A .pro-file should work on Windows, Linux and Mac, but you usually will tweak the build for a platform/compiler by introducing scopes.

        In practice you will want to switch between the platforms regularly: It is so easy to introduce some OS or compiler specific code that will break the build for one or more platforms. When working in a team having one developer work on windows, one on Linux and one on Mac is a common pattern and developers should be encouraged to use different compilers (or versions thereof) and platforms if you care for cross-platform compatibility. A continuous integration system can also help detect incompatibilities early.

        I would also encourage you to try to write your code in such a way that as much of it is build on all platforms as possible, even if it might not make too much sense. The compiler will catch many errors and having it see as much code as possible is a great help when refactoring. In creator we use https://qt.gitorious.org/qt-creator/qt-creator/blobs/master/src/libs/utils/hostosinfo.h in favor of preprecessor defines for this reason.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved