Reputation: 18113
I'm trying to build Qbs example collidingmice
on Windows 10 x64 and got the following error message:
Qt5Cored.lib(Qt5Cored.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86'
I tried setting the following in the collidingmice.qbs
qbs.architecture : "x64"
and got the message
'x64' differs from the architecture produced by this compiler (x86)
I then tried
qbs.architecture : "x86_64"
which gives the error message;
'x86_64' differs from the architecture produced by this compiler (x86)
I then tried
qbs.architecture : "x86"
which gives the error message;
Qt5Cored.lib(Qt5Cored.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86'
Is there a way to set target machine type e.g. to 'x86'
or 'x64'
in Qbs?
Upvotes: 0
Views: 262
Reputation: 41
Here's how I fixed the same issue when building an application using the Qbs build system ("Tiled", the game tilemap editor). In my case I am using the Visual Studio 2019 x64 toolchain.
NOTE: This answer assumes that Qt and Qbs are in your PATH.
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
to initialize VS2019 environment variables in your command prompt.cd myproject
mkdir build-myproject
cd build-myproject
qbs setup-toolchains --detect
which should find your VS2019 environments.qbs setup-qt --detect
which should find your Qt environment (assuming you added to PATH).qbs config --list profiles
to show the detected toolchain profiles.Example:
qbs config --list profiles
profiles.MSVC2019-x64.cpp.compilerVersion: "19.25.28614"
profiles.MSVC2019-x64.cpp.toolchainInstallPath: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.25.28610/bin/Hostx64/x64"
profiles.MSVC2019-x64.qbs.architecture: "x86_64"
profiles.MSVC2019-x64.qbs.targetPlatform: "windows"
profiles.MSVC2019-x64.qbs.toolchainType: "msvc"
...
qbs build -f ..\MyAwesomeProject.qbs profile:MSVC2019-x64
Building as x86 can be accomplished in a similar manner, as long as an x86 build of Qt is available. Running the vcvarsall.bat batch file with x86 will set up your command prompt to use the VS x86 environment variables.
Upvotes: 1
Reputation: 831
My guess is that you are using an x86 compiler and an x64 Qt, which will not work. How did you set up your profile?
Upvotes: 2