Im trying to run sample app from wxFreeChart library. After compilation on linking there is an error:
wxcode_msw28d_freechart.lib(wxfreechart_lib_xydataset.obj) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'
I tried to switch linker option\advanced\target machine to MachineX64 but it doesnt work.
Im using visual studio 2008, any suggestion ?
thanks for help
The error is explicit, you are trying to link libraries that were compiled with different CPU targets. An executable image can only contain pure x86 (32-bit) or pure x64 (64-bit) code. Mixing is not possible.
You change the target CPU by creating a new configuration for the project, only changing the linker setting isn't enough. Build + Configuration Manager, Active solution platform combo on upper right, choose New and select x64. That creates a new configuration with several modified project settings, most importantly the compiler that will be used.
Beware that prior to VS2010, the 64-bit compilers are not installed by default. If you don't see x64 in the platform combo then you'll need to re-run setup.exe and turn on the option to install the 64-bit compilers. Then also re-run any service pack installer you may have applied.
A possible approach with less pain points is to use the 32-bit version of the library.
Try changing every occurence of .\Release into .\x64\Release in the x64 properties. At least this worked for me...
In my case it appears it was because I had "copied settings" from a 32-bit to a new configuration (64 bit) and it hadn't updated the libraries. Odd.
1>MSVCRTD.lib(ti_inst.obj) : fatal error LNK1112: module machine type ‘X86’ conflicts with target machine type ‘x64’
this meant “your properties -> VC++ Directories -> Library Directories” is pointing to a directory that has 32 bit libs built in it. Fix somehow!
In my case http://social.msdn.microsoft.com/Forums/ar/vcgeneral/thread/c747cd6f-32be-4159-b9d3-d2e33d2bab55
ref: http://betterlogic.com/roger/2012/02/visual-studio-2010-express-64-bit-woe
An update to i00g's and Thomas' answers, this time for VS2012 (some names have changed). After copying x86 settings over into an x64 target with the configuration manager, you'll have the problem for the same reason as was the case earlier (lib targets aren't correct in the x64 config). Open your .vcxproj (text editor) and replace MachineX86 with MachineX64 where appropriate. (I still haven't found where this is on the property sheets....) This only seems to be necessary with static libs.
Recently,I also encountered this problem. That's because I used qt(
x64
) in vswin32
. If you want to use qt applicationx64
, you could choose vsx64
--as the above. If you want to usewin32
and perhaps you haven't,you need to download qt(32bit
),then correctly set your enviroment, such as thelib
directory, etc.(note: maybe you are is old set inx64(other version)
, if you convert your win32 or x64 into another,Additional Dependencies
includes the old directory!)before going for the step "compile -DIPLIB=NONE filename.cxx" take the path of VIsual Studio installation upto the vcvarsall batch file and change the configuration as shown below.
*C:\apps\MVS9\VC\vcvarsall.bat x86_amd64*
now next step should be
compile -64bit -DIPLIB=none filename.cxx
this solved the problem for me