PORTING MDL - NATIVE CODE

Good Morning, I have a problem porting my apps from mdl to native code.

I've modified my code as it written in the link below reported

http://communities.bentley.com/products/microstation/microstation_v8i/microstation_v8i_programming/w/microstation_v8i_programming_wiki/mdl-_2d00_-native-code-application-development.aspx

But when i compile with microstation shell the next error appear:

[== Building C:\Programmi\Bentley\Program\MicroStation\mdl\objects\UserCase.obj, (D:\Codice\ESEMPI~3\UserCase2\mdl\UserCase.cpp) ==]
cl  -GX  -Dtarget_is_dlm  -IC:\Programmi\Bentley\Program\MicroStation\mdl\include -I -IC:\Programmi\Bentley\Program\MicroStation\mdl\include\geom -IC:\Programmi
\Bentley\Program\MicroStation\mdl\objects -G5dF -D_X86_=1 -Di386=1  -c -W3 -DWIN32 -DwinNT -MD -D_VISCXX -DWIN32_LEAN_AND_MEAN -Od  -nologo -WX -Zi -Od -GZ -Oy-
  -FoC:\Programmi\Bentley\Program\MicroStation\mdl\objects\UserCase.obj D:\Codice\ESEMPI~3\UserCase2\mdl\UserCase.cpp
UserCase.cpp
C:\Programmi\Bentley\Program\MicroStation\mdl\include\toolsubs.h(45) : fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory

I tryed to compile an example but I have the same result.

What can i do?

Alder

Parents Reply Children
  • Michael, I'm developing in the 2004 edition and I have installed visual studio 6.0 and visual studio .net 2003.

  • Make sure that when you open the MicroStation developer Shell that it runs the vcvars32.bat file (check this by seeing what the INCLUDE environment var is set to in the shell).  Also make sure that CL.exe is recognized as a command.  I suspect that since you put in the compiler tools after the dev shell we do not call the vcvars32.bat file to set the "native" side of things).

    HTH,

  • Mark, INCLUDE environment isn't set in my mstndevvars.bat:

    @echo off

    echo Visual C++ product directory could not be found.

    echo Set nttools to Visual C++ product directory.

    echo Set LIB and INCLUDE appropriately.

    set nttools=

    set LIB=

    set INCLUDE=

    ...

    It's set like environment variable

    INCLUDE = C:\Programmi\Microsoft Visual Studio .NET 2003\SDK\v1.1\include\

     

    It's OK?

     

    If I remove "set INCLUDE=" statement from my mstndevvars.bat the compilers run but I'm not able to solve the error below reported:

    error C2220: warning treated as error - no object file generated

     

    What can I do?

     

    Thanks

    Alder

  • Order of Installation

    Mark made a comment about the order of installation of the Microsoft tools and MicroStation. When you install MicroStation (more specifically, the MicroStation SDK) it looks for an installation of Visual Studio. It modifies mstndevvars.bat at install time to look for the SDK folders and it also sets the value of NTTOOLS (the Visual Studio tools).

    If you install MicroStation before Visual Studio it can't find NTTOOLS. Therefore, it's best to install MicroStation after installing Visual Studio.

    You can edit mstndevvars.bat manually to fix the problem. It should contain a line similar to this [your path to VC98 will be different] …

    set nttools=G:\PROGRA~1\VISUAL~1\VC98

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • FWIW, another option would be to "reinstall" the MicroStation SDK... just to make sure that everything else that might be related is taken into account.

      

  • Taking a big step back...  If the developer shell is reporting that it cannot find the stdio.h header file you can modify your make file to add the stdlib directory to your include path(s) that the tools are using.  To do this you will need to add a line that looks like this:

    dirToSearch="path to where your std include files are"  

    then a line that looks exactly like this:

    %include cincapnd.mki

    the cincapnd.mki will add the path defined in the dirToSearch to the c include path.  

    Also did you manually run the vcvars32 batch file?

    HTH,

  • Mark, I made another step, but I have another problem now.

    I add 2 lines in my make file:

    dirToSearch = C:/Programmi/Bentley/Program/MicroStation/mdl/include/stdlib/

    %include cincapnd.mki

    And now the error that appear in my developer shell is

    C:\Programmi\Bentley\Program\MicroStation\mdl\include\stdlib\stdio.h(30) : fatal error C1189: #error:  This file is intended for MDL only.

    BMAKE: call trace

    Thanks.

    Alder

    N.B. I run manually the vcvars32 batch file and this is the result:

    D:\Codice\Gestuti_Ora\AppsComuni\AAAProva>"C:\Programmi\Microsoft Visual Studio .NET 2003\Common7\Tools\vsvars32.bat"
    Setting environment for using Microsoft Visual Studio .NET 2003 tools.
    (If you have another version of Visual Studio or Visual C++ installed and wish
    to use its tools from the command line, run vcvars32.bat for that version.)

  • C:\Programmi\Bentley\Program\MicroStation\mdl\include\stdlib\stdio.h(30) : fatal error C1189: #error: This file is intended for MDL only

    The MDL environment doesn't use the C standard I/O. It substitutes its own functions for those in the C standard stdio.h.

    Because you are compiling using C++, you want to use the standard C++ I/O. The solution is simple: remove any #include statements in your source files that mention include\stdlib\*.h. You may need to add the appropriate C++ header files if you want to use the standard I/O functions.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions