Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Unable to specify target architecture as x64 [Windows][Visual Studio 2015 compiler]



  • Hi,

    I am trying to compile a project from command line using, qmake and jom and I am getting error during compilation. But the same project compiles successfully, when done from Qt Creator. I am running the same commands, which are being shown in the 'compile' window in Qt Creator, but still it fails. On analyzing the compilation logs, I can see that some of the flags for cl.exe are not coming, when I run from the command line. Any help or pointers, will be highly appreciated.

    Error:

    link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /DLL /SUBSYSTEM:WINDOWS /MANIFEST:embed /OUT:D:\all_files\work\projects\modelfactory.dll @C:\Users\john\AppData\Local\Temp\modelfactory.dll.5148.7098.jom
    libprotobuf.lib(generated_message_util.obj) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'

    Compiler output from QtCreator

    cl -c -nologo -Zc:wchar_t -FS -Zc:strictStrings -Zc:throwingNew -O2 -MD -GR -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -EHsc -DUNICODE -DWIN32 -DWIN64 -DMODELFACTORY -DMODELFACTORY_LIBRARY -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -ID:\all_files\work\projects\Parserlib -I. -I"C:\Program Files\CustomModule\lang\c++\protobuf3\include" -I"C:\Program Files\CustomModule\lang\c++\protobuf3\compiler" -I"C:\Program Files\CustomModule\lang\c++\CustomModule\include" -IC:\Qt\Qt5.7.0\5.7\msvc2015_64\include -IC:\Qt\Qt5.7.0\5.7\msvc2015_64\include\QtGui -IC:\Qt\Qt5.7.0\5.7\msvc2015_64\include\QtANGLE -IC:\Qt\Qt5.7.0\5.7\msvc2015_64\include\QtCore -Irelease -IC:\Qt\Qt5.7.0\5.7\msvc2015_64\mkspecs\win32-msvc2015 -Forelease\ @C:\Users\john\AppData\Local\Temp\cmodelfactory.obj.3644.109.jom

    Compiler output when run from command line

    cl -c -nologo -Zc:wchar_t -FS -Zc:strictStrings -Zc:throwingNew -O2 -MD -GR -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -EHsc -DUNICODE -DWIN32 -DMODELFACTORY -DMODELFACTORY_LIBRARY -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -ID:\all_files\work\projects\Parserlib -I. -I"C:\Program Files\CustomModule\lang\c++\protobuf3\include" -I"C:\Program Files\CustomModule\lang\c++\protobuf3\compiler" -I"C:\Program Files\CustomModule\lang\c++\CustomModule\include" -IC:\Qt\Qt5.7.0\5.7\msvc2015_64\include -IC:\Qt\Qt5.7.0\5.7\msvc2015_64\include\QtGui -IC:\Qt\Qt5.7.0\5.7\msvc2015_64\include\QtANGLE -IC:\Qt\Qt5.7.0\5.7\msvc2015_64\include\QtCore -Irelease -IC:\Qt\Qt5.7.0\5.7\msvc2015_64\mkspecs\win32-msvc2015 -Forelease\ @C:\Users\john\AppData\Local\Temp\cmodelfactory.obj.10396.31.jom

    Missing params in command line

    -DWIN64

    Thanks in advance,
    Sanoj


  • Lifetime Qt Champion

    Hi @sanojsubran,

    libprotobuf.lib(generated_message_util.obj) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'

    Do you open a "Visual Studio Command Prompt"?

    • If yes, then you have to choose the correct one for 32 or 64 bit.
    • If no, then how do you specify the path to your compiler?

    Regards



  • How do you call qmake from command line? It should look something like this:

    pushd C:\
    "C:/Qt/5.11.0/msvc2015_64/bin/qtenv2.bat"
    "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/vcvarsall.bat" amd64
    popd
    qmake
    nmake
    

    the amd64 argument to vcvarsall being the key here



  • @aha_1980 I was running from windows console. I was running vcvars32.bat file to set up the env variables.



  • @VRonin It worked. Thanks a lot. :)


Log in to reply