tags:

views:

188

answers:

2

My laptop is 64-bits, so when I start to use Qt, I chose 64-bit QtCreator. Now I'm facing a problem, I wish that the executable files I generated are runnnable on 32-bit linux system.

Can I set QtCreator to generate 32-bit executable files? So that I can decide I want to generate 32-bit ones or 64-bit ones.

I don't want to install another 32-bit QtCreator ><.

+3  A: 

You will need to install a 32-bit Qt, at least. You shouldn't need to install a 32-bit Qt Creator, though.

Once you install a 32-bit Qt, you should be able to add that version to Qt Creator and have it work without much trouble. You may need to force Creator to use the linux-g++-32 mkspec while compiling. If you build the 32-bit Qt yourself, you can do this by configuring with -platform linux-g++-32. If you install it from a package, hopefully the package builder has already done this.

Intransigent Parsnip
Thank you :)Now I've installed 32-bit Qt, but I'm not very familiar with QtCreator setting. From the QtCreator and the "Qt Version" option, I can only specify the location of "qmake". How can I do configuration and switch between 32 and 64-bits?
Claire Huang
A: 

I've figure out how to generate 32-bit codes.

from the "project" tab in QtCreator: Build Settings Build Steps QMake -> show detail

put following arguments in "Additional arguments":

-spec linux-g++-32 -r
Claire Huang
That's right, you must have installed a 32 bit Qt beforehand, though.Also, one thing I forgot before: some 64 bit distributions of Linux simply don't support compiling 32 bit binaries (they don't ship any gcc with a working `-m32` flag).
Intransigent Parsnip