How to choose 32bit compiler on 64bit QT Creator(Windows7 x64)



  • Hi,

    Have anyone knows how to build 32bit program by QT Creator 64bit?

    I have a 32bit visual c++ library need to be included to QT project,
    it seems that must be used on QT Creator 32bit or it always get
    "...LNK2019: unresolved external symbol..."

    Currently,
    I installed both QT Creator 32/64bit on my working machine and it looks workable,

    I would like to consulting that whether have anyway to build 32bit program on QT Creator 64bit?
    (ex: copy some files/libs from 32bit QT to 64bit...)

    Thanks~


  • Lifetime Qt Champion

    Hi,

    It's not a Qt Creator decision (it's only an IDE) and Qt Creator's architecture also has nothing to do with that.

    You have to install Qt for the architecture you want to build for (that's valid for any library you want to use not just Qt).


  • Moderators

    To add to what SGaist said: in addition to Qt 32bit you need a compiler generating 32bit binaries.



  • In "QT Version" tab of toolbar->Tools->Options->Build&Run,
    I noticed it point to a folder "<QT_32bit path>\Qt5.5.1\5.5\msvc2013" for QT_32bit,
    "<QT_64bit path>\Qt5.5.1\5.5\msvc2013_64" for QT_64bit,

    I tried to copy msvc2013 folder from QT_32bit to QT_64bit,
    then I can see msvc2013 32bit compilers from Compilers tab in Build&Run,
    and I can manual add msvc2013 32bit to QT Versions, Kits tab in Build&Run,

    after those, I can include the 32bit library and build/run my program through QT_64bit.

    But I'm not sure that everything will be fine,
    I tried to compare installation path of QT_32bit and QT_64bit,
    they're basically same but the root location of installation path has a file components.xml,

    the file seems something to describe components setting for QT,
    that is different between QT 32bit and 64bit,
    I guess something will be wrong if I keep developing 32bit program on QT_64bit...?


  • Moderators

    "I tried to copy msvc2013 folder from QT_32bit to QT_64bit" - why?
    I really don't understand what you are doing.

    You just need two things:

    1. 32bit Qt
    2. Compiler generating 32bit code

    That means if you have msvc2013 then install Qt msvc2013 (it is called "msvc2013 32-bit" in Qt maintenance tool), create a kit and select Qt32bit and the 32 bit msvc compiler there. You should already see the compiler in the "Compilers" tab - it has (x86) suffix.



  • @jsulm said:

    "I tried to copy msvc2013 folder from QT_32bit to QT_64bit" - why?

    Just try to build 32bit program by 64bit QT,
    because I have installed 64bit QT and I don't like to install whole 32bit QT just for building 32bit program,
    (I have ubuntu and windows in same hard drive, the space is running out...)

    so I guess maybe I can copy something from 32bit QT to 64bit QT...?
    and yes, after I copied the folder I can build 32bit program through 64bit QT,
    but I don't know whether that is no problem...


  • Lifetime Qt Champion

    From your description you just overwrote the content of your 64bit Qt.

    And no that's not an option, if you want to build for both architecture, you'll need to have both version of Qt installed. Note that you don't need to grab both offline installers to get them. The online installer offer to install both.


  • Moderators

    @ChunKai-Wang No, you cannot build 32bit app using 64bit Qt! You just overwrote your 64bit Qt with 32bit one. You have to install 32bit Qt if you want to build 32bit Qt apps. I don't see why it is an issue to install it, hard drive space does not cost much these days.



  • Actually I don't think what I did is overwriting,
    because I didn't overwrite anything, but just add a folder "msvc2013" from 32bit QT to 64bit QT,
    in 64bit QT, the folder is named "msvc2013_64", that won't be touched.

    then I have choices of 32bit or 64bit in 64bit QT, both them can be built and run.
    of course I doubt that would keep no problem...


  • Lifetime Qt Champion

    Did you copy or move the folder ?

    In any case, you could have spared the place from the beginning using the online installer.

    I'd recommend you do the cleanup so you ensure you have a proper setup to develop.



  • Hi @SGaist ,
    I did offline install for 32bit and 64bit QT to different path,
    then copy msvc2013 folder from
    32bit QT installation path (C:\QT_x86\QT5.5.1\)
    to
    64bit QT installation path (C:\QT\QT5.5.1\),
    this is just an experiment...

    I think QT IDE can choose 32bit or 64bit compiler,
    but it doesn't be released as such bundle,
    not sure why,
    however I'll keep working on QT 32bit for using the 32bit library,
    maybe remove QT 64bit for saving space because I should not really need 64bit program.

    Hi @jsulm ,
    about hard drive, price isn't problem,
    the problem is my notebook has only one slot...

    Thanks~


  • Lifetime Qt Champion

    Qt Creator doesn't care about which architecture your Qt is built for. It also allows to build projects for Android/iOS/generic devices/etc.

    Because usually people wanting to support several architectures or MSVC compilers will go with the online installer.

    The offline packages are targeting one architecture for one compiler so it stays in a reasonable size.



  • @SGaist said:

    ecause usually people wanting to support several architectures or MSVC compilers will go with

    Hi @SGaist ,
    So if I use online install QT, it would include 32bit and 64bit option for compiling?

    Thanks~


  • Moderators

    If you use the online installer you can select which Qt you want to install. You can even install Qt for Android for example.



  • Ah....haha, online installation solved problem...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.