[Interest] Target machine not set in projects generated by qmake for Visual Studio

Ben Swerts benswerts at telenet.be
Mon Jun 3 23:27:48 CEST 2013

> Hi Everybody!
> When I build my Qt 4.8.4 projects on Windows 7, I always get this warning:
> 	LINK : warning LNK4068: /MACHINE not specified; defaulting to X86
> and later:
> 	<project_name> - 0 error(s), 1 warning(s)
> which sucks.   I have tried changing mkspecs/win32-msvc2008/qmake.conf to
> include /MACHINE:X86 in QMAKE_LFLAGS, which works well for the moment.
> will need changing once we go to X64 builds.
> How should I specify this in the qmake.conf file so that X32 or X64 builds
> generated correctly by qmake?
> Thanks.
> Tony

Hi Tony,

This is how I modified the .pro files of my projects:

win32 {
  contains(QMAKE_HOST.arch, x86_64) {
    QMAKE_LFLAGS         += /MACHINE:X64
  } else {
    QMAKE_LFLAGS         += /MACHINE:X86

IIRC this selects X64 if you run Windows 64 bit. You would have to omit the
check if you only want 32 bit builds now. I don't know how you select this
setting depending on the Qt libraries you use for a given build.

Hope it helps,


More information about the Interest mailing list