Question about cross platform programming in Qt
-
Hello, i have a few questions.
Can i compile my program into one file and have it run on windows, mac, and Linux?
How does Qt's cross platform ability work?
Thank you very much! -
[quote author="ravens" date="1333920814"]Can i compile my program into one file and have it run on windows, mac, and Linux?[/quote]
No, you have to build your application for each platform that you target. Qt is cross platform because same source code runs successfully on different platforms after it is build for them.
-
Ah, so i will need to compile it 3 times on 3 different OS's or from 1 OS?
There would be no way to load the correct code using preprocessors to determine the OS?
Thanks for the help. -
Yes, please check the following articles for details about Qt on the three platforms that you are interested in:
- "Qt on Windows":http://qt-project.org/wiki/Support_for_Windows
- "Qt on Mac OS X":http://qt-project.org/wiki/Support_for_Mac_OS_X
- "Qt on Linux/X11":http://qt-project.org/wiki/Support_for_Linux_X11
-
No, you cannot create one single executable file that will execute on all three platforms. You really have to generatel separate executables.
-
[quote author="leon.anavi" date="1333922138"]Yes[/quote]
[quote author="Andre" date="1333968057"]No, you cannot create one single executable file that will execute on all three platforms. You really have to generatel separate executables. [/quote]
Just to avoid misunderstands I would like to point out that my positive answer was about the statement that the source has to be build 3 times to target all of the platforms :)
-
In fact, this is a pure C++ problem. As you can't compile your C++ program into one file and have it run on windows, mac, and Linux.
However, if you using pure qml, there is another problem.