Hello,
Could some one tell me the step by step procedure to cross compile the "HelloWorld" Qt App from Windows to Linux.
Regards,
Sankar.
Hello,
Could some one tell me the step by step procedure to cross compile the "HelloWorld" Qt App from Windows to Linux.
Regards,
Sankar.
Hi,
Im guessing the hello world example is:
main.cpp
Qt Code:
include <qapplication.h> include <qpushbutton.h> int main( int argc, char **argv ) { hello.resize( 100, 30 ); a.setMainWidget( &hello ); hello.show(); return a.exec(); }To copy to clipboard, switch view to plain text mode
So, if you already have a .pro file (project file) you just need to copy the source from windows into linux. Then remove any .o moc_* ui_* and makefile. Then run qmake where the .pro is (this will generate new moc_ and ui_ files) then run make.
If you don't have a pro file, you can use this as template:
helloWorld.pro
Qt Code:
QT += core gui TARGET = HelloWorld TEMPLATE = app SOURCES += main.cppTo copy to clipboard, switch view to plain text mode
Do you want to cross-compile, i.e. build a Linux executable in a Windows environment, or just build it on a Linux box? The latter option is trivial. The former option, well, I've never heard of anyone developing for Linux on a Windows machine.
Thanks qlands & Chris.
Chris,
Yes, my goal is to create an application which will be running primarily on Windows and for few customers on Linux platform. Since I am not familiar with cross-compiling, I raised this question. I don't want to compile my code again in a Linux machine.
I heard that using Qt, we can cross compile to Linux platform from Windows environment. Could you please help me to learn Qt Cross-Compilation.
Regards,
Sankar.
Last edited by sankar; 20th September 2011 at 07:46.
If you want to cross-compile, you need a cross-compiler. You could probably follow this description: http://metamod-p.sourceforge.net/cro...for.linux.html. However I think it is much simpler to either run a livecd Linux distribution or install a Linux distribution on VirtualBox and build from within there. Otherwise you will have to first cross-compile Qt and possibly other libraries your application requires.
Doesn't require cross-compiling.
Please tell me that there is reason for this other than you think it is easier. Cross-compiling on one platform for another is always more work than building natively. You have to establish Win32 tool chains and compilers that target Linux, build any Linux libraries that Qt depends on, build Qt, build any other libraries your app requires, and then hack a Qt prf file to use these tools. (Some of that might be available in Cygwin: see the very old http://metamod-p.sourceforge.net/cro...for.linux.html) You're going to have to have Linux machine(s) (virtual machine is fine) to test on anyway, so why not build there.Since I am not familiar with cross-compiling, I raised this question. I don't want to compile my code again in a Linux machine.
Where did you hear that? Qt makes it easy to take the same source and build it in different environments. There are tools to build on Linux and Windows targeting the mobile platforms. There are reasonably straightforward ways to cross-compile on Linux for embedded Linux. Getting a compiler suite and tool chain on Linux to target Windows is also reasonably easy thanks to MingW (e.g. http://silmor.de/29). I have not seen instructions to go the other way in recent times.I heard that using Qt, we can cross compile to Linux platform from Windows environment. Could you please help me to learn Qt Cross-Compilation.
Bookmarks