PDA

View Full Version : Cross platform application???



Shuchi Agrawal
14th February 2007, 05:02
hi,
I think there are very few posts( or may be none) on this forum abt making cross platform applications.
Can anyone enlighten me that how can we make a simple application( may be like hello world), cross platform( to be able to run on linux, if made on windows)?
Do we need to install the same version of Qt on the system on which we want to run the exe made on other system? Like for example, i made a program of simply drawing lines and some 3d features which uses Qglwidget and all.now its successfully executing on my system. if i am trying to simply take tht exe on other system(where the Qt is not installed) and run tht then its giving error like Qtopengl4.dll or Qtgui4.dll is not found.
so this means that we need to install Qt on the system where all we want to execute its exe?
so now if its true then can anyone tell me that how can we make the exe independent of the platform and the fact tht Qt shd be installed to run its exe??
please give the links from internet or documentaion of Qt if its there because i could not find the information which i need.

thanks

VireX
14th February 2007, 06:17
You need to have Qt installed on the platform you want to support, and compile it there. You cannot compile under one platform and run it in another ever.

Shuchi Agrawal
14th February 2007, 06:30
You need to have Qt installed on the platform you want to support, and compile it there. You cannot compile under one platform and run it in another ever.

ok but can i run without recompilation for same platform but different machines( like 2 different Pc with same configuration but one not installed with Qt) ?

jpn
14th February 2007, 06:46
ok but can i run without recompilation for same platform but different machines( like 2 different Pc with same configuration but one not installed with Qt) ?
Take a look at: Deploying Qt Applications (http://doc.trolltech.com/4.2/deployment.html)
An application written with Qt needs Qt libraries to run. You have basically two ways:

provide shared libs together with your application
link the libs statically into your application

wysota
14th February 2007, 18:55
You cannot compile under one platform and run it in another ever.

Actually you can, this is called cross-compiling. But you'll still be able to run the program on the target platform and not on both.

It's an obstacle you cannot overcome. Windows, Unix and MacOS use completely different concepts of a binary file, process, etc. so there is no way to have a single binary work on all three platforms. There is a possibility of having some kind of script which would run on all three platforms and that would have embedded binaries for all platforms and run the appropriate one. Of course this still leaves the problem on different hardware architectures on different platforms (i.e. PowerPC vs i386 vs ARM vs m68k vs...)

Shuchi Agrawal
15th February 2007, 04:27
thanks a lot for this info. can you refer me some more technical details in some links about this and to what extent i can make my programs cross platform.
i basically want to know that what all i need to do on a linux system to run a program which is coded and successfully executed on windows XP.

Brandybuck
15th February 2007, 05:36
thanks a lot for this info. can you refer me some more technical details in some links about this and to what extent i can make my programs cross platform.
You need to compile and link on your target platforms. The source code is cross platform, but you still need to build on all platforms. The included qmake utility will help you greatly. Please see the qmake documentation. It comes with Qt.

If you are still having problems, I would greatly urge you to get the book "C++ GUI Programming with Qt 4". It will contain all the information you need.