Reputation: 41
I'm using Windows 7 64 bit QT 5.9.1 with the compiler MSCV 2017 64 bit.
I am trying to build a 32 bit application in this environment and linking to a 32 bit library, but I can't seem to fight the correct combination of options to accomplish this nor do I know if this is even possible.
I've seen some solutions use
TARGET = 32bit_binary
QMAKE_CXXFLAGS += -m32
but I can't seem to figure out how to adapt it to this environment. Any tips?
EDIT: I should also mention that I have no internet access nor do I have admin rights on the machine that I am using so installing new versions is not possible.
My project is also a subdirs project with 3 different .pro files. When I make one change to one pro file, I usually apply the change to all of them.
EDIT 2: This is to resolve errors
LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
LNK2019: unresolved external symbol referenced in function
I believe that once I can compile it in 32 bit, these errors will go away, but I am unsure if that is the case.
EDIT 3: I do have a 32 bit version of qt but it's in MINGW so it cannot properly find the QMAKE_MSC_VER and so on down the rabbit hole. If there are any tips on how to make it work with MSCV2017 that would be appreciated.
Upvotes: 4
Views: 11601
Reputation: 11807
To solve this problem, you need a 32 bit kit for Qt. For that, you have to go to Tools > Options > Build & Run > Kits
. However, if you just installed Qt 64 bit, this kit will most likely not be available. Thus, you should launch the Qt Maintainenance Tool from Start -> Programs -> Qt -> Qt Maintenance Tool
. From here, you have to skip the Qt login, unless you are using a commercial version of Qt, and then click Add or remove components
. Now you should select the kit that you want (Qt 32 bit), and Qt will install the(se) kits automatically. Once this is complete, then you can go back to the Kits menu and add them.
Upvotes: 5
Reputation: 2134
You should create a 32 bit kit in Qt Creator to generate a 32 bit executable.
To configure your kits go to: Tools > Options > Build & Run > Kits
.
After that, you can active the kit for your project.
Upvotes: 2
Reputation: 73294
I believe the canonical text to put into your .pro file would be this:
CONFIG -= x86_64
CONFIG += x86
(The first line makes sure that building of 64-bit binaries won't happen, and the second line makes sure that building of 32-bit binaries will happen)
Upvotes: 3