Viz Studio 2013 error when include MicrostationAPI.h

Hello,


After one full evening of research, I decided to post my nooby problem here. Basically, I just want to start a microstation project in Viz Studio 2013.

I had both include Microstation :

MicroStation\mdl\include
MicroStation\mdl\MicroStationAPI


Into the main file, I added

#define winNT
#include <MicroStation.API>
BEGIN_BENTLEY_NAMESPACE

That's all, but compiler returns me many error (14), these are the 4 firsts :

Error    1    error C2146: syntax error : missing ';' before identifier 'size_type'    c:\users\tom\bentley\microstation\mdl\include\memutilallocator.h    42    1    MdlTEST
Error    2    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int    c:\users\tom\bentley\microstation\mdl\include\memutilallocator.h    42    1    MdlTEST
Error    3    error C2146: syntax error : missing ';' before identifier 'difference_type'    c:\users\tom\bentley\microstation\mdl\include\memutilallocator.h    43    1    MdlTEST
Error    4    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int    c:\users\tom\bentley\microstation\mdl\include\memutilallocator.h    43    1    MdlTEST

Anyway, I cannot do anything, it's always wrong somewhere into these files.

Of course I checked all http://www.la-solutions.co.uk/content/Publications-MDL.htm#ArticleIndexDevTools, thanks Jon, but I couldn't find a solution.

Could you see what's wrong ??

Thank you and have a nice day

Tom

Parents
  • Unknown said:
    I just want to start a MicroStation project in Viz Studio 2013

    When writing a native-code C/C++ application, use the right version of Viz Studio!

    Unknown said:
    #include <MicroStation.API>

    No such object MicroStation.API!  If it's the header file you want to include, then do this...

    #include <MicroStationAPI.h>

     
    Regards, Jon Summers
    LA Solutions

  • Yes of course, MicroStation.h

    So I am probably using a wrong version, I will try with an old one.

  • If you MUST use MicroStation V8 2004 Edition (i.e. v08.05...) and you are using that release of MicroStation on an operating system that it was certified for use on, your best bet is to use pure MDL, which is delivered with the product. This would not involve anything other than that -- no Visual Studio, no Java, etc. Just do a complete install and the "SDK" is included in the ..\mdl\... area.

    BTW, the JMDL link you mention is for MicroStation/J... that has long since been removed from the product.

      

  • Unknown said:
    I saw JMDL

    Obsolete!  Do not use!  Read this article about MicroStation Development Languages

    Unknown said:
    I cannot use Visual C/C++ 6.0 because it doesn't exist anymore

    Only if you take out an MSDN subscription.

    MicroStation VBA

    Unknown said:
    My goal is really easy just open a DGN file, read the elements from it and close it

    MicroStation VBA is the answer.  It's delivered with all versions of MicroStation V8.  It works the same on all versions.  It's independent of problems such as compiler and operating system versions.

    Open a DGN file ...

    Sub OpenDesignFile()
        Application.OpenDesignFile "C:\folder\Laruve.dgn"
    End Sub

    Scan the active model...

    Sub ScanActiveModel()
        Dim oElements As ElementEnumerator
        Dim oCriteria As New ElementScanCriteria
        oCriteria.ExcludeNonGraphical
        Set oElements = ActiveModelReference.Scan(oCriteria)
        Do While oElements.MoveNext
            Dim oElement As Element
            Set oElement = oElements.Current
            Debug.Print "Element ID " & _
               DLongToString(oElement.ID) & _
               " type " & CStr(oElement.Type)

        Loop
    End Sub

     
    Regards, Jon Summers
    LA Solutions

  • Whao, great for these answers, I will check that tonight.

    Previously, I developed an windows application with that : http://dgnlib.maptools.org/

    It's working perfectly, but only for DGN v7. And now we need DGN v8, and that library is not able to open it.

    The main goal is to develop an application which (it could be perfect) runs on a computer without Microstation. The output is a txt file about the elements (text element for example). Imagine a dump into a human readable format.

    Am I clear ?

    Thanks for all your answers and time.

  • Hi Tom,

    Unknown said:
    It's working perfectly, but only for DGN v7. And now we need DGN v8, and that library is not able to open it.

    Yes, V8 is completely different than V7. And V7 was based on ISFF format, which was made public, so it was possible to write libraries to write and read the format. DGN V8 is a proprietary Bentley format without public description (but you can ask for the format description) and much more complex than quite simple V7.

    Unknown said:
    The main goal is to develop an application which (it could be perfect) runs on a computer without Microstation.

    It depends on your requirements. If you need 100% fidelity or at least to use some special features, the only way is to use MicroStation (or another application, which allow to create 3rd party applications) as an engine. But you can also try to use Teigha SDK from Open Design Alliance. It's developed outside Autodesk and Bentley, so there is no guarantee all features are supported, but it's the only independent alternative I know about.

    With regards,

      Jan

  • Unknown said:
    The main goal is to develop an application which runs on a computer without MicroStation

    Something else you might have mentioned earlier.  All the MicroStation development languages created by Bentley Systems assume and require that the MicroStation libraries are present and available.  The simplest way to ensure that those conditions are met is to build a DLL.

    None of the MicroStation development languages created by Bentley Systems can be used to create a stand-alone executable where MicroStation is not present.

    In other words, we cannot help you any further on this MicroStation Programming Forum.  Follow Jan's suggestion: contact the Open Design Alliance.

     
    Regards, Jon Summers
    LA Solutions

  • Unknown said:

    There is also nice tutorial Learning MDL Step by Step writen by Yongan Fu available in BDN blog.

    I would like to add a supplement. If you've read Learning MicroStation Addins Step by Step, beware of the chapter 9 because author Yongan.Fu used VS 2010 to compile. I am afraid that it is not suggested although no one mentioned it before.

  • Unknown said:
    Beware of the chapter 9 because author Yongan.Fu used VS 2010 to compile

    It's not clear what point you are making.  An AddIn is written using a .NET language.  Any version of Viz Studio can be used to write an AddIn, provided that it is built for the compatible version of the .NET CLR.  Currently the compatible version (for MicroStation V8i) is .NET v3.5.

    A native-code MDL application must use the correct version of C++. Therefore the developer must use the version of Viz Studio that delivers the correct version of C++.  For MicroStation V8i, the correct version is Viz Studio 2005.

    However, in this case the question is: "How do I write an application that opens a DGN file without MicroStation?"  The MicroStation development tools, using any language, do not let you write a stand-alone application that runs without MicroStation.

     
    Regards, Jon Summers
    LA Solutions

  • Unknown said:

    An AddIn is written using a .NET language.  Any version of Viz Studio can be used to write an AddIn, provided that it is built for the compatible version of the .NET CLR.  Currently the compatible version (for MicroStation V8i) is .NET v3.5.

    I am afraid that it is not true and actually I think I did the same things as Tom last week. Here is the result of compiling Addins with VS 2013. It is very similar to what Tom mentioned.

  • Unknown said:
    I am afraid that it is not true

    It's true and Jon is right, it's possible to use any version of Visual Studio to create MicroStation add-in, as far as a code is compiled into CIL for CLR 2.0 (which is used in NET 2.0 - 3.5). Any NET language can be used like C#, VB.NET or C++/CLI.

    Based on what I can see at your screen capture I guess it's a native C++ project, not NET project? If you have a problem with Visual Studio 2013 and NET add-in (not native C++, because VS 2013 compiler is not supported for MicroStation), post a new thread to this forum. I use VS 2013 every day to work on my C#/NET add-ins for MicroStation and other products, so I am sure it works fine.

    Regards,

      Jan

  • I rewrite the supplement.

    Tom, if you've read Learning MicroStation Addins Step by Step, beware of the chapter 9 because author Yongan.Fu used VS 2010 to compile. Inside the chapter 9 he was using native C++ code. I am afraid that it is not suggested although no one mentioned it before.

Reply Children
No Data