c++ - When Visual Studio generates 32bit .obj file and 64bit .obj file? -
i have 2 machines, both of have same copy of code. both machines installed same visual studio, vs2013 ultimate version.
the code qt project lots of windows apis. so, qmake
generate makefile
, makefile.debug
, makefile.release
. these makefile
same on both machines.
in makefile.debug
, makefile.release
, actual compiler , linker vs's cl , link
. difference between 2 machines is, 1 windows 10, , other windows 8.1. both machines 64-bit machine.
the problem is, on windows 10 machine, build progress in qt creator passes, on windows 8.1 machine, there 1 error while building. firstly, error "xxx.dll: lnk1112: module machine type 'x64' conflicts target machine type 'x86'"
. know here "xxx.dll"
indeed 'x64'
type, , realized windows 8.1 machine thinks "target machine type" x86
, modified makefile.debug
manually adding "/machine:x64" linkflag
. action changed error become "yyy.obj: module machine type 'x86' conflicts target machine type 'x64'"
. yeah, time vs's link knows target machine should 'x64', looks vs's compiler still compile cpp file 32-bit .obj file.
my question is, why vs's cl
thinks should make 32-bit obj file rather 64-bit obj file? and, how let vs's cl
make 64-bit obj?
i checked cl command on both machines. same below.
cl -c -nologo -zc:wchar_t -fs -zi -mdd -gr -w3 -w34100 -w34189 -w44996 -ehsc /fd..\<some folder> -dxxx -iyyy -fodebug\ @c:\users\someuser>\appdata\local\temp\zzz.obj.8160.63.jom zzz.cpp
visual studio provides different compilers (i.e. cl.exe binaries) different architectures.
check compiler gets called qt creator (for x64 architecture should <ms vs dir>/vc/bin/amd64/cl.exe
). guessing either coming default setting in environment (path
variable) or have setup qt creator correctly build right architecture.
Comments
Post a Comment