PDA

View Full Version : Cross-compiler Qt4 app from ubuntu to windows xp



tiho_bg
1st December 2011, 06:30
Hi everybody

I am working with qt4 under ubuntu. I have developed one application for control of a specific digital camera and a hardware device for control of piezo-actuators. The application is working well under ubuntu. My question is: Is it possible to make something like exe file under ubuntu that I could use under Windows XP? I will install all drivers needed for my specific hardware but I am not sure if this will work.

I tried the following example from http://stackoverflow.com/questions/18240…inux-to-windows.
I wrote the following code in ubuntu terminal:

sudo apt-get install mingw32
cat > main.c <<EOF
int main()
{
printf("Hello, World!");
}
EOF
i586-mingw32msvc-cc main.c -o hello

The result was that I have installed mingw32 and finally I have created main.c main.o and hello files.
I am new in this and I don't understand how to proceed further.

I don't understand the line below:
Replacing apt-get for yum, or whatever your Linux distro uses. That will generate a hello.exe for Windows.

What I have to write in the terminal and where I have to replace apt-get?

Also where I have to set CC=i586-mingw32msvc-cc and where to write this code:
CC=i586-mingw32msvc-cc ./configure && make

Finally I would like to work under ubuntu making executable files that could work under Windows for specific control hardware using their specific .dll libraries and drivers.

Thank you in advance

Best regards

Oleg
1st December 2011, 10:11
Link is broken.


Replacing apt-get for yum, or whatever your Linux distro uses.
yum is package manager for Fedora, so you don't need it.


CC=i586-mingw32msvc-cc ./configure && make
This should be run in terminal to build autotools-based project.

The simplest way will be to build Qt Libraries with MinGW in Linux (maybe prebuilt package will also work) and then configure Qt Creator to use this toolchain. AFAIR, there were some problems with default mingw32 and Qt, so we used MinGW-w64 (mingw-w64.sourceforge.net).

tiho_bg
1st December 2011, 15:13
Thank you for your answer.

When I write this code:
CC=i586-mingw32msvc-cc ./configure && make
I've receive the following error:
bash: ./configure: No such file or directory

May be I have to be in root directory not in the directory where is the main.c file.
Please help me!!!

Oleg
1st December 2011, 17:52
This command configures and builds something :) You should build your qt project using mingw compiler. And I am not sure that prebuilt Qt libs will work with cross-compiler.