Important: Please read the Qt Code of Conduct -

How to build Win64 project using Win32 OS.

  • Good day.
    I need to build a project using Windows XP x86 to run in Win x64. How can I do it?
    MVS2010 has x86_amd64 compiller. So, MSVS2010 lets me to build the project for Win64 using Win32.
    When I run qmake, it creates lnk file with paths where Qt was installed (c:\Qt\4.7.4). If I move qt dirrectory, qmake creates file with the same paths (c:\Qt\4.7.4). So, I think that this paths are in qt binaries. Can I change this paths to run from the network disk?

  • [quote author="aikidzin" date="1326354925"]Good day.
    I need to build a project using Windows XP x86 to run in Win x64. How can I do it?

    The 64bit versions of Windows can happily run 32bit code. Do you really need a 64bit version of your application?

  • I build dinamic library, that will be used by x64 native application. I think x32 library will not link with x64 application.

  • You can build x64 but you need to compile qt in x64. There are a lot of ways to do that. If you want to use nmake you must start the visual studio console that is for x64. You can find it in start menu at Visual Studio Tools or something Visual Studio 2008 x64 Cross Tools Command Prompt....
    Having the x64 version of Qt you must select in visual studio the configuration to x64 then click on Qt from the menu/ Qt options and add the path for the version.
    At this point you should have in the list both Qt versions. After that click again on Qt/ Qt project settings and in the last line add x64 version than build ...

  • I already built x64 and x32 versions of Qt.
    I build my project from command line, I don't use IDE. As I build in Win32, I must run 32bit version of qmake. And qmake creates file with INCPATHs from c:\Qt\4.7.4, but not from the directory, where qmake is. If I have 64bit of qmake, I can run it only in Win64.

    @E:\Compiler\QT\4.7.4\bin\qmake.exe ..\ -o qmyqt.lnk -spec win32-msvc2010
    E:\Compiler\MSVC100\VC\bin\nmake.exe -f qmyqt.lnk
    cl -c -nologo -Zm200 -Zc:wchar_t- -Zi -MDd -GR -EHsc -W3 -w34100 -w34189 -DUNICODE -DWIN32 -D_AMD64_ -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"c:\Qt\4.7.4\include\QtCore" -I"c:\Qt\4.7.4\include\QtSql" -I"c:\Qt\4.7.4\include" -I"c:\Qt\4.7.4\include\ActiveQt" -I"c:\Qt\4.7.4\mkspecs\win32-msvc2010" qmyqt.cpp@

  • Before compiling run: vcvarsall.bat"" x86_amd64, or E:\Compiler\MSVC100\VC\vcvarsall.bat"" x86_amd64, should work.

    c:\Qt\4.7.4\ is the path to x64 build of Qt?

  • No, c:\Qt\4.7.4\ is the dirrectory, where 32bit version of Qt was installed. I moved that dirrectory to the E:\Compiler\QT\4.7.4. Also, I have directory with 64bit Qt - E:\Compiler\QT\4.7.4_x64.

    I ran E:\Compiler\MSVC100\VC\vcvarsall.bat x86_amd64 before compiling. No effect.
    Can I manually change paths after qmake in the lnk file to use 64bit version?
    Now in lnk file after qmake
    QMAKE = e:\Compiler\QT\4.7.4\bin\qmake.exe
    INCPATH = -I"c:\Qt\4.7.4\include\QtCore".......

  • Try this:
    1.vcvarsall.bat"" x86_amd64
    2.E:\Compiler\QT\4.7.4\bin\qmake.exe ..\ -o qmyqt.lnk -spec win32-msvc2010
    3.E:\Compiler\MSVC100\VC\bin\nmake.exe -f qmyqt.lnk
    cl -c -nologo -Zm200 -Zc:wchar_t- -Zi -MDd -GR -EHsc -W3 -w34100 -w34189 -DUNICODE -DWIN32 -D_AMD64_ -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"E:\Compiler\QT\4.7.4_x64\include\QtCore" -I"E:\Compiler\QT\4.7.4_x64\include\QtSql" -I"E:\Compiler\QT\4.7.4_x64\include" -I"E:\Compiler\QT\4.7.4_x64\include\ActiveQt" -I"E:\Compiler\QT\4.7.4_x64\mkspecs\win32-msvc2010" qmyqt.cpp

  • Also try changing the vars for qt. Before 1.vcvarsall.bat enter this:

    set QTDIR= E:\Compiler\QT\4.7.4_x64
    set PATH= E:\Compiler\QT\4.7.4_x64\bin;%PATH%
    set QMAKESPEC=win32-msvc2010

  • I executed
    set QTDIR= E:\Compiler\QT\4.7.4_x64
    set PATH= E:\Compiler\QT\4.7.4_x64\bin;PATH
    set QMAKESPEC=win32-msvc2010
    E:\Compiler\MSVC100\VC\vcvarsall.bat x86_amd64
    E:\Compiler\QT\4.7.4\bin\qmake.exe ..\ -o qmyqt.lnk -spec win32-msvc2010
    but in qmyqt.lnk.Debug INCPATH still
    INCPATH = -I"c:\Qt\4.7.4\include\QtCore" .......

Log in to reply