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

Hello everyone,

I was trying to compile (MicroStation Connect version 10000025) delivered MDL example through MicroStation Connect Edition SDK (version 10000028) as Administrator, however, I'm getting the fatal error above. My computer is running on both 32 and 64 bit and loaded with Visual Studio Community edition, I hope someone out there had a similar problem before and can help me solve my dilemma...

Thanks,

Ed

Parents
  • Hi Ed,

    your post is a bit void and some important information is missing:

    Unknown said:
    I was trying to compile ... as Administrator

    What does it mean? Did you compile an example using Developer Shell or using Visual Studio?

    Unknown said:
    however, I'm getting the fatal error above

    What example did you compile? Is it example specific or you received the same message for mre examples?

    Unknown said:
    My computer is running on both 32 and 64 bit

    What does it mean?

    Unknown said:
    Visual Studio Community edition

    What version? Community Edition exists as 2013 and 2015, but the required version for C++ and mixed assemblies VS 2013 is required. To build pure managed code (C#, VB.NET...) the version of Visual Studio is not so critical.

    Unknown said:
    can help me solve my dilemma

    It will hardly to happen without more information. The error description is quite clear, it looks like a project properties are not set correctly or your developer shell is not configured properly.

    Can you post how your developer shell is configured and also the full make log?

    With regards,

      Jan

  • Hi Jan,

    1. I used the Developer Shell (Run as administrator)

    2. I tried to compile TagsExample under Annotations.

    3. My computer is running on both 32 and 64 bit, it was loaded with both V8i and Connect Edition, I cannot compile on any of them so I took out V8i and tried to compile Connect Edition delivered examples.

    4. VS 2013 was installed before, but I installed VS Community on top of it, and it is a 2015 version.

    The MicroStationDeveloperShell that I used is as is, as delivered, do I have to re-configure it?

    Please see below, thanks...

    @echo off

    :: NOTE: Shell title, paths, and short file name usage defaults are provided.  Customize or override environment as needed.
    :: Arg 1: Bentley Product install root directory (MS)
    :: Arg 2: Bentley SDK root directory (MSMDE)
    :: Arg 3: (New 10.00) Optional resource intermediate output files directory (MSMDE_OUTPUT)
    :: Report user elevation and shell characteristics
    for /f "tokens=1,2,4-6 delims=[] " %%a in ('ver') do set OSDESC=%%a %%b %%c
    if defined ProgramFiles(x86) (set OSARCH=64-bit) else (set OSARCH=32-bit)
    if defined PROCESSOR_ARCHITEW6432 (set SHELLARCH=32-bit) else (set SHELLARCH=64-bit)
    openfiles.exe 1>nul 2>&1 && (set USERELEVATION=Administrative User) || (set USERELEVATION=Standard User)
    echo [Windows] & echo. & echo   %OSDESC% (%OSARCH%), Command Shell (%SHELLARCH%), %USERELEVATION%
    echo. & echo [Command Line] & echo. & echo   %CMDCMDLINE% & for %%a in ("%~0" "%~1" "%~2" "%~3") do if %%a NEQ "" echo   Arg: %%~sa  [%%~fa]
    :: If present, call developer shell extension (pre-process script)
    pushd %~dps0bin & for /f "tokens=*" %%a in ('where mdlsdk1000_preproc.bat 2^> nul') do (echo. & echo [%~nx0 is calling: %%a] & call %%~sa)
    :: Configure Bentley development environment. Use parameters provided then try environment
    set SHELLTITLE=MicroStation CONNECT Developer Shell (%SHELLARCH%) - %USERELEVATION% [REQUIRES: Visual Studio 2013]
    if "%~1" NEQ "" (set MS=%~s1) else (for %%a in ("%MS%") do set MS=%%~sa)
    if "%~2" NEQ "" (set MSMDE=%~s2) else (for %%a in ("%MSMDE%") do set MSMDE=%%~sa)
    if "%~3" NEQ "" (set MSMDE_OUTPUT=%~s3) else (for %%a in ("%MSMDE_OUTPUT%") do set MSMDE_OUTPUT=%TEMP%\Bentley\MicroStationSDK\)
    set MDLBIN=%MSMDE%bin\
    set PATH=%PATH%;%MS%;%MDLBIN%;%MSMDE%MigrationTools\
    set BMAKE_OPT=-I%MSMDE%mki
    set DEFAULT_TARGET_PROCESSOR_ARCHITECTURE=x64
    set DLM_NO_SIGN=1
    :: Report Bentley development environment, change to examples directory
    echo. & echo [MicroStation Development Environment]
    echo. & for %%a in (MS MDL PATH) do @set %%a | findstr -vi "MS_ PATHEXT" & echo.
    pushd %MSMDE%examples
    title %SHELLTITLE%
    :: If present, call developer shell extension (post-process script)
    for /f "tokens=*" %%a in ('where mdlsdk1000_postproc.bat 2^> nul') do (echo. & echo [%~nx0 is calling: %%a] & call %%~sa)
  • Hi Ed,

    I tried to compile TagsExample and it was finished without any warning on my computer.

    Unknown said:
    My computer is running on both 32 and 64 bit

    I guess I understand what do you want to tell, but the sentence makes no sense. But it's fine, you have both MicroStation V8i and CONNECT Edition installed. No reason to discuss 32 and 64bit, because V8i exists in 32bit version only and vice versa CE was released only as 64bit application, so the situation is clear.

    Unknown said:
    I cannot compile on any of them

    All examples delivered with MicroStation SDK should be fully functional and if any problem is reported during the building process, it's typically caused by a wrong configuration.

    Unknown said:
    VS 2013 was installed before, but I installed VS Community on top of it, and it is a 2015 version.

    Visual Studio cannot be installed on top of another Visual Studio. There are delivered as independent products and are installed in parallel to separate folders (I suppose you don't change VS2015 default folder to be the same as VS2013) and can be used in parallel.

    MicroStation CONNECT Edition requires Visual Studio 2013 for native examples compilation and make files use also VS 2013 for compilation of NET examples. But if your VS2015 is installed correctly in parallel, it should be fine, I have also several different versions of Visual Studio Professional installed side by side.

    Unknown said:
    The MicroStationDeveloperShell that I used is as is, as delivered, do I have to re-configure it?

    No, it should not be modified, but you should study it and understad how it works and what it does. Several different variables are used (MS, MSMDE and optionally MSMDE_OUTPUT) and it's the question how they are set? And also how PATH variable is used. The variables values used for the shell are displayed when the shell is started. You have to check if they are set correctly.

    My developer shell starts like this:

    Don't care about variables like MSV8i, they are my local, important are at first MS and MSMDE and Path.

    With regards,

      Jan

  • Hi Jan,

    I brought this up during EAP, I gave up because I was not able to make it work, as I said before, I cannot compile anything because it's giving me fatal error LNK1112.

    My dev shell is similar to yours, except V8i was taken out. I didn't set any environment variables because I was thinking that it will be set automatically when installed.

    I googled the link error and it's telling me that it's visual studio related, the problem is I don't know how to fix it and I was hoping that you guys may be able to help me.

    Please see the developer shell below and the compiling problem in red,

    Thanks,

    Ed

    [Windows]

      Microsoft Windows 10.0.10240 (64-bit), Command Shell (64-bit), Administrative User

    [Command Line]

      "C:\Windows\System32\cmd.exe" /x /k ""C:\Program Files\Bentley\MicroStationCONNECTSDK\MicroStationDeveloperShell.bat" "C:\Program Files\Bentley\MicroStation CONNECT Edition\MicroStation\" "C:\Program Files\Bentley\MicroStationCONNECTSDK\""
      Arg: C:\PROGRA~1\Bentley\MICROS~2\MICROS~1.BAT  [C:\Program Files\Bentley\MicroStationCONNECTSDK\MicroStationDeveloperShell.bat]
      Arg: C:\PROGRA~1\Bentley\MICROS~1\MICROS~1\  [C:\Program Files\Bentley\MicroStation CONNECT Edition\MicroStation\]
      Arg: C:\PROGRA~1\Bentley\MICROS~2\  [C:\Program Files\Bentley\MicroStationCONNECTSDK\]

    [MicroStation Development Environment]

    MS=C:\PROGRA~1\Bentley\MICROS~1\MICROS~1\
    MSMDE=C:\PROGRA~1\Bentley\MICROS~2\
    MSMDE_OUTPUT=C:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\

    MDLBIN=C:\PROGRA~1\Bentley\MICROS~2\bin\

    PATH=C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Windows\sysWOW64\;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Users\Ed Juan\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\PROGRA~1\Bentley\MICROS~1\MICROS~1\;C:\PROGRA~1\Bentley\MICROS~2\bin\;C:\PROGRA~1\Bentley\MICROS~2\MigrationTools\


    C:\PROGRA~1\Bentley\MICROS~2\examples>cd annotations\tagsexample

    C:\PROGRA~1\Bentley\MICROS~2\examples\Annotations\TagsExample>bmake +a
    Bentley Systems Make Utility. Version 08.21.00.16, Feb 12 2015
    Wed Oct 21 21:36:44 2015


    ~mkdir C:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\
    ~mkdir C:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\rscobj\
    ~mkdir C:\PROGRA~1\Bentley\MICROS~1\MICROS~1\mdlapps\

    [== Building C:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\TagsExamplecmd.h, (C:\PROGRA~1\Bentley\MICROS~2\examples\Annotations\TagsExample\TagsExamplecmd.r) ==]
    rcomp @C:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\make.opt
    MicroStation Resource Compiler 03.06.02
       Generating header file (C:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\TagsExamplecmd.h) ... done.

    [== Building C:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\rscobj\TagsExamplecmd.rsc, (C:\PROGRA~1\Bentley\MICROS~2\examples\Annotations\TagsExample\TagsExamplecmd.r) ==]
    rcomp @C:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\make.opt
    MicroStation Resource Compiler 03.06.02

    [== Building C:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\TagsExample.obj, (C:\PROGRA~1\Bentley\MICROS~2\examples\Annotations\TagsExample\TagsExample.cpp) ==]
    cl -IC:\PROGRA~1\Bentley\MICROS~2\include\ -IC:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\    -GS- -EHc -GR -wd4345 -GF -favor:blend -D_X64_ -wd4701 -wd4244 -wd4564 -wd4702 -c -W4 -DBENTLEY_WARNINGS_HIGHEST_LEVEL -DWIN32 -DwinNT -MD -D__EXCEPTIONS -D_VISCXX -Gy -wd4996 -Ox -Oy- -Os -D_CONVERSION_DONT_USE_THREAD_LOCALE -D_SECURE_SCL=0 -DWIN32_LEAN_AND_MEAN  -DNTDDI_WIN7SP1=0x06010100 -we4692   -nologo -WX -MP -Zi -FdC:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\objects.pdb    -EHs   -fp:fast -FoC:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\TagsExample.obj C:\PROGRA~1\Bentley\MICROS~2\examples\Annotations\TagsExample\TagsExample.cpp
    TagsExample.cpp

    [== Building C:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\TagsExampleCreateTagSet.obj, (C:\PROGRA~1\Bentley\MICROS~2\examples\Annotations\TagsExample\TagsExampleCreateTagSet.cpp) ==]
    cl -IC:\PROGRA~1\Bentley\MICROS~2\include\ -IC:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\    -GS- -EHc -GR -wd4345 -GF -favor:blend -D_X64_ -wd4701 -wd4244 -wd4564 -wd4702 -c -W4 -DBENTLEY_WARNINGS_HIGHEST_LEVEL -DWIN32 -DwinNT -MD -D__EXCEPTIONS -D_VISCXX -Gy -wd4996 -Ox -Oy- -Os -D_CONVERSION_DONT_USE_THREAD_LOCALE -D_SECURE_SCL=0 -DWIN32_LEAN_AND_MEAN  -DNTDDI_WIN7SP1=0x06010100 -we4692   -nologo -WX -MP -Zi -FdC:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\objects.pdb    -EHs   -fp:fast -FoC:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\TagsExampleCreateTagSet.obj C:\PROGRA~1\Bentley\MICROS~2\examples\Annotations\TagsExample\TagsExampleCreateTagSet.cpp
    TagsExampleCreateTagSet.cpp

    [== Building C:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\TagsExamplePlaceTagFromText.obj, (C:\PROGRA~1\Bentley\MICROS~2\examples\Annotations\TagsExample\TagsExamplePlaceTagFromText.cpp) ==]
    cl -IC:\PROGRA~1\Bentley\MICROS~2\include\ -IC:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\    -GS- -EHc -GR -wd4345 -GF -favor:blend -D_X64_ -wd4701 -wd4244 -wd4564 -wd4702 -c -W4 -DBENTLEY_WARNINGS_HIGHEST_LEVEL -DWIN32 -DwinNT -MD -D__EXCEPTIONS -D_VISCXX -Gy -wd4996 -Ox -Oy- -Os -D_CONVERSION_DONT_USE_THREAD_LOCALE -D_SECURE_SCL=0 -DWIN32_LEAN_AND_MEAN  -DNTDDI_WIN7SP1=0x06010100 -we4692   -nologo -WX -MP -Zi -FdC:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\objects.pdb    -EHs   -fp:fast -FoC:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\TagsExamplePlaceTagFromText.obj C:\PROGRA~1\Bentley\MICROS~2\examples\Annotations\TagsExample\TagsExamplePlaceTagFromText.cpp
    TagsExamplePlaceTagFromText.cpp

    [== Building C:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\TagsExample.mi, (C:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\TagsExamplecmd.rsc) ==]
    rlib @C:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\make.opt
    MicroStation Resource Librarian 03.06.02

    [== Building "C:\PROGRA~1\Bentley\MICROS~1\MICROS~1\mdlapps\TagsExample.dll", (C:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\TagsExample.obj) ==]
    link -out:"C:\PROGRA~1\Bentley\MICROS~1\MICROS~1\mdlapps\TagsExample.dll"  -WX   -Ignore:4087 -Ignore:4089 -Ignore:4199  -MANIFESTUAC:NO -Release   -debug -incremental:no -fixed:no @C:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\TagsExamplelink.rsp
    Microsoft (R) Incremental Linker Version 12.00.31101.0
    Copyright (C) Microsoft Corporation.  All rights reserved.

    -dynamicbase
    -dll
    "-out:C:\PROGRA~1\Bentley\MICROS~1\MICROS~1\mdlapps\TagsExample.dll"
    "-implib:C:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\TagsExample.lib"
    "-pdb:C:\PROGRA~1\Bentley\MICROS~1\MICROS~1\mdlapps\TagsExample.pdb"
    -debug -incremental:no -fixed:no
    -MANIFEST
    -MANIFESTFILE:C:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\TagsExample.dll.Manifest
    C:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\TagsExample.obj C:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\TagsExampleCreateTagSet.obj C:\Users\EDJUAN~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\TagsExamplePlaceTagFromText.obj C:\PROGRA~1\Bentley\MICROS~2\library\bentley.lib C:\PROGRA~1\Bentley\MICROS~2\library\BentleyAllocator.lib C:\PROGRA~1\Bentley\MICROS~2\library\mdlbltin.lib C:\PROGRA~1\Bentley\MICROS~2\library\RmgrTools.lib C:\PROGRA~1\Bentley\MICROS~2\library\BentleyGeom.lib C:\PROGRA~1\Bentley\MICROS~2\library\DgnPlatform.lib C:\PROGRA~1\Bentley\MICROS~2\library\dgnview.lib gdi32.lib user32.lib kernel32.lib C:\PROGRA~2\MICROS~1.0\VC\\lib\amd64\msvcrt.lib
    C:\PROGRA~1\Bentley\MICROS~2\library\mdlbltin.lib
    BentleyGeom.lib(BentleyGeom5.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'
    BMAKE: call trace
        line:  404, C:\PROGRA~1\Bentley\MICROS~2\mki\dlmlink.mki
        line:  108, C:\PROGRA~1\Bentley\MICROS~2\examples\Annotations\TagsExample\TagsExample.mke
    Wed Oct 21 21:36:51 2015, elapsed time: 0:07

    C:\PROGRA~1\Bentley\MICROS~2\examples\Annotations\TagsExample>

  • Hi,

    Unknown said:
    My dev shell is similar to yours

    Yes, for the first sight I see nothing wrong, but there is probably something subtle in your configuration, what causes the reported error.

    Unknown said:
    I didn't set any environment variables because I was thinking that it will be set automatically when installed.

    It's true as long as there is no other MicroStation SDK installed. But if you have e.g. MicroStation SDK V8i installed and you set up configuration variables and/or path for V8i SDK as Windows variables, it can cause troubles in CONNECT Edition SDK. But my feeling is that's not the discussed case.

    Unknown said:
    I googled the link error and it's telling me that it's visual studio relate

    Absolutely not. I am not sure what is your knowledge how building process (regardless C, C++ or C#) works and how Visual Studio works, but this error messare relates to linker, which is definitely not Visual Studio. Ok. it's delivered as a part of VS installation, but VS itself is nothing else than editor, that based on installation, configuration and project settings calls other tools like Visual C SDK or NET Framework SDK, that are usually (but not necessarily) installed together with VS.

    To be as precise as possible can help to track down the source of the problem and of course is expected in professional software development.

    Unknown said:
    the problem is I don't know how to fix it

    The problem is exactly specified: Target platform is set to X86 (which is not correct), but the linked libraries are targetted to X64 (correct). So the question is where wrong target platform (/MACHINE switch) is defined.

    Unknown said:
    and I was hoping that you guys may be able to help me.

    Because we don't know all details about your computer installation and configuration, we can provide guesses only:

    • Delete everything is temporary folder used for compilation to be sure there are no scraps from previous compilations.
    • Using modify option check if your Visual Studio 2013 was installed with 64bit compilers.
    • Using bmake -v +a TagsExample.mke > log.txt create detail log file from the compilation and try to analyse it.

    With regards,

      Jan

  • I'll get back to this one and try to figure what the problem is, thanks for your help Jan...
Reply Children
No Data