April 8, 2012

ravens ravens
Lab Rat
2 posts

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!

6 replies

April 8, 2012

leon.anavi leon.anavi
Area 51 Engineer
1217 posts
ravens wrote:
Can i compile my program into one file and have it run on windows, mac, and Linux?

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.

 Signature 

http://anavi.org/

April 8, 2012

ravens ravens
Lab Rat
2 posts

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.

April 8, 2012

leon.anavi leon.anavi
Area 51 Engineer
1217 posts

Yes, please check the following articles for details about Qt on the three platforms that you are interested in:

 Signature 

http://anavi.org/

April 9, 2012

Andre Andre
Robot Herder
6399 posts

No, you cannot create one single executable file that will execute on all three platforms. You really have to generatel separate executables.

April 9, 2012

leon.anavi leon.anavi
Area 51 Engineer
1217 posts
leon.anavi wrote:
Yes
Andre wrote:
No, you cannot create one single executable file that will execute on all three platforms. You really have to generatel separate executables.

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 :)

 Signature 

http://anavi.org/

April 9, 2012

1+1=2 1+1=2
Hobby Entomologist
639 posts

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.

 
  ‹‹ [Solved] Overlapping Widgets input problems      Debugging paint event = segmentation fault? ››

You must log in to post a reply. Not a member yet? Register here!