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\includeMicroStation\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 MdlTESTError 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 MdlTESTError 3 error C2146: syntax error : missing ';' before identifier 'difference_type' c:\users\tom\bentley\microstation\mdl\include\memutilallocator.h 43 1 MdlTESTError 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
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 I attempt to compile an example with bmake, I have this error:
BMAKE: Error - Attempting to build with VS 2005 but location is undefined!
(cl.exe is in my path)
Unknown said:Is there lib file somewhere else that I am missing?
Once again, you ask a question that we can't answer without seeing your code.
If you look in the MDL documention, you will find both the header file (required by the compiler) and the library file (required by the linker) for each function. For example...
Description
Required Header
Required Library
Jon, this is my code, really basic:
#define winNT #include "stdafx.h" #include <iostream> #include <mdl.h> #include <mssystem.fdf>
//BEGIN_BENTLEY_NAMESPACEvoid useless() { int fd = mdlSystem_newDesignFile("toto.dgn"); } //END_BENTLEY_NAMESPACE int _tmain() { std::cout << "Hello World!" << std::endl; useless(); return 0; }
Hope it's all right.
Unknown said:The additional library path is set exactly like in your picture
My screenshot shows also a number of library (.lib) files that are specified in the Viz Studio project settings.
Unknown said:BMAKE: Error - Attempting to build with VS 2005 but location is undefined!
It probably means something is wrong in your Visual Studio 2005 installation or Windows configuration.
All example makefiles include AssertToolSet.mki that contains logic how path to VisualStudio tools (e.g. C++ compiler, linker etc.) is discovered. By default, it's taken from registry, in the case of VisualStudio 2005 it's HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/8.0/Setup/VS. The message means the makefile decided VisualStudio 2005 is the tool which should be used (which is correct), but was not able to find the key in registry (doesn't exist or not enough access right to access the registry).
A workaround can be to define VS2005Dir variable as a parameter passed to bmake (e.g. +dVS2005Dir=C:\...), which will cause registry check will be skipped. I recommend to open the mentioned mki file, it iluustrates well what and when is checked.
Regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Unknown said:C:\Program Files (x86)\Bentley\Program\MicroStation
You may need to use Windows short file names (also known as DOS file names) that have no spaces. Read this tip:
http://www.la-solutions.co.uk/content/MDL/MdlDevelopmentEnvironment.htm#WindowsShortFileNames
Jon: I agree, but one thing is weird, I did a grep on the lib files, no one contain the string "mdlSystem_newDesignFile" isn't it wrong ?
If you do not mind, it might be a good idea to cover some basics (this is not meant to insult, it is mainly to make sure that these things have been done in the order they should be done in).
Here are some simple steps to compile the MyApp application for a straight, out-of-the-box, default installation (if you change any of the folder locations during the installation of the MicroStation SDK, you will need to use the folder structure you selected in some of the steps below):
Once you have done the above, again assuming defaults for everything, you should have an application that you can run in a MicroStation session.
Could you confirm that is working for you?
Unknown said: I did a grep on the lib files ...
Using the file search tool of my preferrred text editor, I found this:
Searching for: mdlSystem_newDesignFIlemdlbltin.lib(475): mdlbltin.lib(1970): ^jmdlbltin.lib(21961): mdlbltin.lib(21962): mdlbltin.lib(21963): mdlbltin.lib(21964): Found 6 occurrence(s) in 1 file(s)
1) I have Visutal studio 2005 Express Edition
2) I have Microstation 08.05.02.70
3) I have the sdk downloaded from here www.bentley.com/.../MicroStation+SDK.htm
4) When I run "MicroStation Developer Shell" I have many errors, I fixed them by launching manually the script mstndevvars.bat with the correct argument.
5) Into a mdl example "basic", I can run bmake +dVS2005Dir=C:\... I have an error "LINK : fatal error LNK1104: cannot open file 'C:\PROGRA~2\Bentley\Program\mdlapps\basic.dll'"
I still cannot link my previous code, I keep continue to try
Thank you guys for your attention.
This could be the source to a most of your problems.
1. You really should use the full version of Visual Studio 2005. We did not test using the Express Edition, but given some of the differences we encountered when trying to use the 2008 full and Express versions, it would not surprise me one bit if that is part of the issue.
2. You are using MicroStation V8 2004 Edition (v08.05...) unless there is a specific need to use that (10 years old), we really recommend using the most current release of MicroStation V8i -- that is certainly going to make it easier to create native code applications.
3. The version of the SDK that you have is MicroStation V8i (v08.11.07). You really should use the same version series of MicroStation and MicroStation SDK -- the most recent for both is v08.11.09... there is a note on the page you reference that offers a significant hint regarding this:
NOTE: The MicroStation SDK requires MicroStation V8i to be installed to compile applications. It is recommended that you use the same 8-digit versions of MicroStation and MicroStation SDK. Refer to the MicroStation SDK ReadMe for more information.
4. That could be because of a combination of the above three things.
5. That could be because of a combination of the above four things.
In short, I suspect if get a full version of Visual Studio 2005 and the latest releases of MicroStation and MicroStation SDK (and follow the recipe in a previous reply), that most -- if not all -- of your issues will go away.
Unknown said: 1) I have Visutal studio 2005 Express Edition 2) I have Microstation 08.05.02.70
Both important details you might have mentioned earlier! We assume you are using the current version of MicroStation unless you tell us otherwise. MicroStation v8.05 (MicroStation 2004 Edition) uses a still earlier version of Viz Studio.
Furthermore, the MicroStationAPI C++ API was not available for that version of MicroStation — you must use MDL.
Unknown said: I have the sdk downloaded from here www.bentley.com/.../MicroStation+SDK.htm
I believe that link is for a later version of MicroStation. MicroStation V8.05, as far as I can remember, included the SDK. You must use the correct SDK for your version of MicroStation.
Ok, but where can I find the correct SDK ?
I saw into the Microstation's folder jmdl folder with some jar file, maybe I can use Java to open my DGN file, isn't it ?
Should I use the trial version ?
Unknown said:Ok, but where can I find the correct SDK ?
The correct SDK for what version? If you will use MicroStation V8 2004 Edition, which in general is not recommended, because it's quite obsolete and not supported anymore, the whole SDK is, exactly as Jon mentioned, the part of the product installation. If you choose full installation and didn't modify the content anyhow, it should be there.
To build native application for V8 2004 Edition, you have to use Visual C/C++ 6.0 (so forget Visual Studio whatever number). Alternatively you can compile your code to binary pseudocode using MDL compilers. It's treated as obsolete, but the tools are still available in SDK and if you don't require extensive linking of external tools, it will solve the problem with the righ Microsoft compiler.
Or you can move to the current V8i version and in such case SDK can be downloaded from SELECTservices web and Visual Studio 2005 is the tool you should use.
Jan, your answer is pretty clear, thank you.
My company uses this old version of Microstation, so I cannot change that.
But, my question is, if I build a native windows application with a most recent version. Does my application need this specific version of Microstation to run or it can run on any similar windows ?
Unknown said:My company uses this version of Microstation [v8.05]
You must use Viz Studio 6 SP3
Unknown said: If I build a native windows application with a most recent version
You must consult Microsoft sites, such as MSDN, to learn more about Viz Studio 6 and compatibility with Windows versions. You need to install the Microsoft Windows Platform SDK for your chosen version of Windows. Keep in mind that MicroStation V8.05 is not certified for use with the latest versions of Windows.
Unknown said:Does my application need this specific version of MicroStation to run
Yes: we say 'use Viz Studio 6' for your application because that is the version of C++ used to build MicroStation V8.05. Later versions of MicroStation use later versions of Visual C++. An application built using Viz Studio 6 is likely to differ substantially from the same application built using, say, Viz Studio 2005 for MicroStation V8i.
Welcome to the Bentley Programming forums. As a tip, if you have (new) questions that are not directly related to the original (deviate), it is good practice to start a new Forum posts for each topic. This helps not only yourself find the final response/answer to a (single) particular question quickly, but all other forum members too.
Unknown said:But, my question is, if I build a native windows application with a most recent version. Does my application need this specific version of Microstation to run or it can run on any similar windows ?
You should always match:
NOTE: The MDL SDK version can safely drift only within the last part of the Version Quad; designated by .xx in this example: 08.11.09.xx. If the version number varies in any of the first three parts of the Version Quad it is highly recommend that you:
HTH,Bob
Fine, I understand everything you are telling me.
I am a little bit desperate, my goal is really easy just open a DGN file, read the elements from it and close it, that's all
Could you advice me a way to do that, any language ?
Just I cannot use Visual C/C++ 6.0 because it doesn't exist anymore.
I saw JMDL, especially this link : www.ad.ntust.edu.tw/.../overview.html
But nothing about opening a file.
Again thanks for your answers
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.
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) LoopEnd Sub