fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'AMD64'

KK. picture KK. · Apr 1, 2010 · Viewed 31k times · Source

I am using VS 2003 .Net on 32 bit XP OS. I have also installed "Microsoft Platform SDK" on my machine. Can I build vc++ application (binaries) targeted for 64 bit OS?

I am using following project options :

    Name="VCLinkerTool"
    AdditionalOptions="/machine:AMD64 bufferoverflowU.lib"
    OutputFile="\bin\Release\MM64.dll"
    LinkIncremental="1"
    SuppressStartupBanner="TRUE"
    AdditionalLibraryDirectories=""C:\Program Files\Microsoft Platform SDK\Lib\AMD64""
    GenerateDebugInformation="TRUE"
    ProgramDatabaseFile="\bin\Release\MM64.pdb"
    GenerateMapFile="TRUE"
    MapFileName="\bin\Release\MM64.map"
    MapExports="TRUE"
    MapLines="TRUE"
    OptimizeReferences="2"
    EnableCOMDATFolding="2"
    ImportLibrary=".\Release/MM64.lib"
    TargetMachine="0"/>

I am getting following error:

fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'AMD64'

Do I need to build project on 64 bit OS or I need to change project settings to resolve this error. Please help me to resolve this issue.

Answer

Fabio de Miranda picture Fabio de Miranda · Apr 3, 2010

I had the same problem today, here's how I solved it (in Visual Studio 2008): Went to Project Properties -> Linker -> Command Line -> Additional Options and removed the /MACHINE:I386 from the linker additional options.

Hope it helps