How to compile example mdl programs

I have installed the latest Microstation Connect and SDK and am trying to compile some of the examples. Can anybody help me get this setup correctly?

  • But be aware it's just a guess!

    My problem is that I have installed SDK in default location, so I cannot check whether there is an issue somewhere else and corrupt the compilation only when location is not standard.

    On the other hand, if specifying full path to included mki files work for you, it's acceptable workaround.

    Regards,

     Jan

  • I broke down and uninstalled the SDK and resinstalled it in the default location. The definiely helped. I am getting a lot further now.

    It still complains about not being able to find mt.exe.

    [== Building "C:\PROGRA~1\Bentley\MICROS~1\MICROS~1\mdlapps\ElementsExample.dll"
    , (C:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStationSDK\objects\ElementsE
    xample.obj) ==]
    link -out:"C:\PROGRA~1\Bentley\MICROS~1\MICROS~1\mdlapps\ElementsExample.dll"  -
    WX   -Ignore:4087 -Ignore:4089 -Ignore:4199  -MANIFESTUAC:NO -Release   -debug -
    incremental:no -fixed:no @C:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStati
    onSDK\objects\ElementsExamplelink.rsp
    Microsoft (R) Incremental Linker Version 14.00.23026.0
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
    -dynamicbase
    -dll
    "-out:C:\PROGRA~1\Bentley\MICROS~1\MICROS~1\mdlapps\ElementsExample.dll"
    "-implib:C:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStationSDK\objects\Ele
    mentsExample.lib"
    "-pdb:C:\PROGRA~1\Bentley\MICROS~1\MICROS~1\mdlapps\ElementsExample.pdb"
    -debug -incremental:no -fixed:no
    -MANIFEST
    -MANIFESTFILE:C:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStationSDK\object
    s\ElementsExample.dll.Manifest
    C:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStationSDK\objects\ElementsExam
    ple.obj C:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStationSDK\objects\Elem
    entsExampleCreateTool.obj C:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStati
    onSDK\objects\ElementsExampleCopyTool.obj C:\Users\KWA0GSU\AppData\Local\Temp\Be
    ntley\MicroStationSDK\objects\ElementsExampleEditTool.obj C:\Users\KWA0GSU\AppDa
    ta\Local\Temp\Bentley\MicroStationSDK\objects\ElementsExampleQueryTool.obj C:\PR
    OGRA~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:\PROGR
    A~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:\PROGR
    A~2\MICROS~3.0\VC\\lib\amd64\msvcrt.lib
    C:\PROGRA~1\Bentley\MICROS~2\library\mdlbltin.lib
       Creating library C:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStationSDK\
    objects\ElementsExample.lib and object C:\Users\KWA0GSU\AppData\Local\Temp\Bentl
    ey\MicroStationSDK\objects\ElementsExample.exp
    mt.exe -manifest C:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStationSDK\obj
    ects\ElementsExample.dll.Manifest -outputresource:"C:\PROGRA~1\Bentley\MICROS~1\
    MICROS~1\mdlapps\ElementsExample.dll";2
    'mt.exe' is not recognized as an internal or external command,
    operable program or batch file.
    BMAKE: call trace
        line:  411, C:\PROGRA~1\Bentley\MICROS~2\mki\dlmlink.mki
        line:  114, C:\mdl2\examples\Elements\ElementsExample\elementsexample.mke
    Wed Mar 06 16:59:56 2019, elapsed time: 0:16
    
    C:\mdl2\examples\Elements\ElementsExample>

    I tried hard coding the path in parentheses: "C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x64/mt.exe". The spaces are still fooling it.

    C:\PROGRA~1\Bentley\MICROS~2\library\mdlbltin.lib
       Creating library C:\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStationSDK\
    objects\ElementsExample.lib and object C:\Users\KWA0GSU\AppData\Local\Temp\Bentl
    ey\MicroStationSDK\objects\ElementsExample.exp
    "C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64\mt.exe" -manifest C
    :\Users\KWA0GSU\AppData\Local\Temp\Bentley\MicroStationSDK\objects\ElementsExamp
    le.dll.Manifest -outputresource:"C:\PROGRA~1\Bentley\MICROS~1\MICROS~1\mdlapps\E
    lementsExample.dll";2
    'C:\Program' is not recognized as an internal or external command,
    operable program or batch file.
    BMAKE: call trace
        line:  411, C:\PROGRA~1\Bentley\MICROS~2\mki\dlmlink.mki
        line:  114, C:\mdl2\examples\Elements\ElementsExample\elementsexample.mke
    Wed Mar 06 17:09:11 2019, elapsed time: 0:16
    
    C:\mdl2\examples\Elements\ElementsExample>

    I finally got it to work by copying mt.exe to the ElementsExample folder. Is it normal to have to do that?

  • Hi Ken,

    I broke down and uninstalled the SDK and resinstalled it in the default location.

    from your anwer it seems you did not do it fully, because your example still resides in c:\mdl2\ and not in C:\Program Files\Bentley\MicroStationCONNECTSDK\examples\.

    Despite of I do not think it can cause any problem, it's not clear what your current configuration is.

    It still complains about not being able to find mt.exe.

    mt.exe tool is a part of Windows SDK, not MicroStation SDK or Microsoft C++ compiler.

    On my computer I can find several these files, but from MicroStation SDK shell version C:\Program Files (x86)\Windows Kits\10\bin\x86\mt.exe seems to be called, but it exists also in \x64 etc.). You can use "where mt.exe" command to check where a particular program is found.

    I finally got it to work by copying mt.exe to the ElementsExample folder. Is it normal to have to do that?

    Absolutely not. MicroStation SDK CONNECT Edition should be able to adapt to local Windows configuration without any manual modification. When any such manual change is necessary,  something is wrong.

    mt.exe is identified and path to it is set (added to PATH variable) during MicroStation SDK startup process, so it should be accessible without full path specification.

    You can try:

    • When command prompt (cmd) is started normally, mt.exe is not found, because Windows Kit path is not set.
    • When you open Developer Command Prompt for VS2015, which is a part of Visual Studio installation, you should be able to use mt.exe.
    • The same is for MicroStation SDK, where you can compare PATH variable how it is set in normal Windows command prompt (DOS shell) and how it's displayed when MicroStation SDK is started.

    I guess should be able to provide better insight where the problem can be.

    With regards,

      Jan

  • Hi ,

    I am sorry to see you having such a difficult time getting up and running with the MicroStation Developer Shell Requirements.  I also wish I could directly point you to the SDK Readme Requirements typically located directly on docs.bentley.com, Through necessity I do know I updated the SDK requirements for Update 12 (due to be released any day) to ensure plenty of Microsoft Visual Studio requirements and installation resource references are available in the typical (local) MicroStation CONNECT SDK Readme. For MSCE SDK U12 and later I will certainly update the SDK Annoucements to reflect current SDK Requirements in full detail.

    So, as you have found you will need to install/configure the "Microsoft Windows 10 SDK" option (even if you don't have Windows 10 yet) due to our product level make file assertion/requirements.  I am looking into seeing if we can make that conditional (internal vs. external/public) since that component to the best of my knowledge if only for applications requiring Debug Diagnostics implementations (we do, but most app developers don't).

    If the Windows SDK is installed and the developer shell can correctly locate your Microsoft Visual Studio "vcvars32.bat" file properly - you can check by typing:

    set _SDKVSENV

    Then the developer shell should be able to locate "mt.exe" using the Microsoft Windows "where.exe" to find the appropriate location, like:

    C:\PROGRA~1\Bentley\MICROS~2>where mt
    C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\mt.exe
    C:\Program Files (x86)\Windows Kits\10\bin\x86\mt.exe

    The developer shell tries to correctly locate and initialize Microsoft's development environment (MSCE SDK U11/VS2015 and prior call vcvars32.bat, MSCE SDK U12/VS2017 and later call VsDevCmd.bat) to do all the proper and heavy lifting to configure it's toolsets properly and we rely on it for our build tools to work properly.

    I believe in MSCE SDK U10 I provided a "build.bat" (has a -verbose option) that can make troubleshooting between developers easier so we can say "send me your 'build' output" and a user can type "build" or "build verbose" to get detailed build output and optional (verbose) full OS environment variables included.

    So, if you are still having issues please try to "build verbose" your example and post your "Build-[YourAppNameHere]-Verbose-Output.txt", and I am sure we can straighten out any outstanding issue preventing you from compiling the SDK examples.

    HTH,
    Bob



  • how do you set the Windows Kit path ?

    There is no reason to set anything like that.

    When your Visual Studio is installed correctly, everything is set, and recognized automatically by bmake / mkl files.

    Regards,

      Jan