views:

1132

answers:

3

I need to cross compile my QT application in Linux. I compiled my application from the QT SDK in Linux and it is working properly.
How do I create an .exe for the same application in Linux. I have installed Mingw in Linux and qmake, but I dont know how to proceed with cross compiling.
How do I link my QT with a cross compiler like MinGW and Qmake. I am using SuSE Linux. I have also gone through http://Silmore/29 but I am not getting a clear picture of how to proceed futher.

A: 

Hi,

Basically, you use your cross-toolchain for the Make process rather than the host toolchain. I assume there is no autotools configure script. If there is you can run configure with --host specified and have it all figured out for you.

So what you'll need to do is set CC, LD, CFLAGs, LDFLAGS (probably also CXX and CXXFLAGS) and modify the Makefile to use the right QT libraries - which will need to be mingw, not your Linux libraries. So you may also need to obtain the MinGW/Windows QT SDK and store it separately so your paths cam be specified properly.

Hope this helps!

Matthew Iselin
Can u be stil more elaborate please... Does mingw hold Windows binaries and dll's ?? as far as my knowledge, mingw holds windows libraries and binary files which help in creating executable for windows, which is installed in Linux m/c,If i give through command as [admin@host:i386mingw-gcc app.cpp -0 app.exe]. pls guide me if i'm wrong..
Correct - the Linux MinGW has Linux executables (i386-mingw-gcc and friends) and Windows libraries (and DLLs). It's designed to allow you to compile your programs for Windows on Linux.Note that to compile C++ you should use i386-mingw-g++, not i386-mingw-gcc.
Matthew Iselin
A: 

You could run the Visual C++ Express Edition 2008 cl.exe through wine to compile your project.

Blindy
i'm not supposed to use wine emulator.. i ned to compile natively in Linux to get .exe.. pls say me the procedure of doin it with Mingw cross compiler in Linux
rasjani
+3  A: 
LiraNuna
i ve installed mingw in my SUSELinux.. but i don find i386-mingwmsvc-gcc :(i do ve i386mingw-gcc and many others... i gave a command likeadmin@host:i386mingw-gcc analogclock.cpp -mwindows -o analogclock.exebut which gave output as: C++ compiler is not installed in this system :(
is that command to create executables for windows??pls tel me what should i do ???
@Cathy, you need to install the appropriate packages to get the compiler.
Evan Teran
While this works for native windows application it doesn't work for Qt applications -- you also need a cross compiled Qt for that to work. Linking against linux Qt libraries doesn't help creating Windows executables.
bluebrother
bluebrother is incorrect - mingw32msvc has support for 'MSVC' format name.lib files (renamed as libname.a and used as -lname), which will work with no problems.
LiraNuna
i have installed MinGW cross compiler in Linux , but i'm not able to create i386mingw32msvc-g++ because of which i'm not able to cross compile my cpp application.what has to be done to create it. in /usr/local/cross-tools/bin i've all these executablesi386-mingw32-addr2line, i386-mingw32-ar, i386-mingw32-as, i386-mingw32-gcc, i386-mingw32-gcc-3.4.2, i386-mingw32-gccbug, i386-mingw32-c++filt, i386-mingw32-cpp, i386-mingw32-size... etc... but not i386mingw32msvc-g++ :(pls help me how to create it in bin .....!!!