Visual Studio Compile 32bit on x64 Machine?



  • Hi is it somehow possible to compile a 32bit exe on a x64bit Windows Operating system?

    I build the libraries as here
    Step 4: Build the Qt Library
    http://doc-snapshot.qt-project.org/4.8/install-win.html

    configure.exe -debug-and-release -opensource -platform win32-msvc2010
    then nmake

    after 10hours it was done.

    When I choose now the Win32 instead of the x64 debug option.

    An Error popup,

    bq. There's no Qt version assigned to this project for platform Win32.

    the x64 debug is working fine, but I'd like to create win32 exe too, for win32 OS.



  • Yes, you can compile and link your code with x86 architecture both with MinGW and MSVC compilers. Just make sure that you have correct bitness of libs and set correct flags. You're compiler suite should also support multi-target compiles. AFAIK MinGW builds package targets both 32 and 64 bit.

    You need also a new compile of Qt for x86.


  • Moderators

    You have to compile Qt separately for 32bit and 64bit.
    You do that by setting appropriate environment variables before you configure and build, like path to your the right compiler version and standard libraries.

    To ease that Visual Studio comes with a .bat script that does that for you called vcvarsall.bat
    It's usually located in <Program Files>\Microsoft Visual Studio 10.0\VC\vcvarsall.bat

    You run it without parameters for 32bit environment and "vcvarsall.bat amd64" for 64bit.
    From there you run configure and nmake (or jom).
    If you do that you don't have to specify the -platform parameter to configure as it will pick it up automatically and let you know what it found (thus allowing you to verify that right version was chosen).


Log in to reply
 

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