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 :
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 Laruve 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!
Tom Laruve said:#include <MicroStation.API>
No such object MicroStation.API! If it's the header file you want to include, then do this...
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.
Jan: I use the Visual Studio compilation, is it wrong ?
Yes, it is wrong ... or better to say you choose a hard way, where it's your responsibility to set everything correctly.
If you use bmake with own (and correct) mke file, everything (nearly) will be set for you automatically. There is a huge number of complex rules hidden in mke and mki files, which if used correctly, cover the most of possible dependencies, settings and configuration requirements.
Test and check any example delivered with MicroStation SDK. They can be compiled usually without any additional change.
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
No example compile with bmake, it always stop at the line %include mdl.mki into the mke.
Anyway, my purpose is to develop a native windows application. As far as I understand these example will produce a DLL, is that right ?
Should I also use bmake for my native win32 application ?
For the moment I search to fix my last error, the "unresolved external symbol _mdlSystem_newDesignFile" error, it's probably a lib file missing or something ?
Tom Laruve said:No example compile with bmake, it always stop at the line %include mdl.mki into the mke.
You should solve this problem at first, because it means something is wrong with your development environment. Do you use MicroStation SDK development shell to compile the examples?
If the shell is set correctly, the compilation cannot end with any error. Sometimes it's required to start the shell as administrator, because the compilation may create folders inside MicroStation folder tree; also digital signature is recommended to switch off, but there are minor modifications, that can be easily identified. For sure no problem with missing header files or similar problems.
Tom Laruve said:Anyway, my purpose is to develop a native windows application. As far as I understand these example will produce a DLL, is that right ?
Yes and no. MicroStation is not able to load native dll files directly, so ma file, which works as loader, has to be created also. All SDK examples use this approach.
Tom Laruve said:Should I also use bmake for my native win32 application ?
Yes, it's the recommended tool, you can start it from Visual Studio environment.
Okay, I think I'm lost.
Do you have a good resource that explain how to configure Visual Studio to build a win32 app using the microstation sdk ?
There are materials available in BDN Community. If you are not a member, you should think about to become.
There is also nice tutorial Learning MDL Step by Step writen by Yongan Fu available in BDN blog.
Also at Bentley LEARN Server there is MicroStation Programming Learning Path with videos covering different aspects and areas of MicroStation development.
For me it looks like you skip the first important step: To be sure SDK and Visual Studio are installed correctly. And it's easy, because no configuration (or not too many) is required:
After you will be able to compile examples, it's time to configure Visual Studio. But DevShell and bmake will be stil the main tools.
Tom Laruve said:"unresolved external symbol _mdlSystem_newDesignFile" error, it's probably a lib file missing or something ?
Learn to distinguish between compiler errors and linker errors (collectively build errors). The Viz C++ error code will tell you: compiler errors are a 4-digit number prefixed 'C' and linker errors are a 4-digit number prefixed 'L'.
unresolved external symbol is a linker error. The C++ linker was unable to find the definition of that function. You probably need to add several MDL .lib files to the linker input.
In Viz Studio, use the project properties dialog...
If building with bmake, then specify the library files with the DLM_LIBRARY_FILES macro like this...
DLM_LIBRARY_FILES = $(mdlLibs)BentleyDgn.lib \ $(mdlLibs)toolsubs.lib \ $(mdlLibs)mdlbltin.lib \ $(mdlLibs)rasterlib.lib \ $(mdlLibs)stdutillib.lib \ $(mdlLibs)mdllib.lib \ Shlwapi.lib
Jon : The additional library path is set exactly like in your picture, to the folder mdl/library.
But I have the "unresolved external symbol" error. Is there lib file somewhere else that I am missing ? I just want to use the 3 functions that you said to me previously.
is the environment variable MS set in your system?
Yes it is, I just checked :
C:\Program Files (x86)\Bentley\Program\MicroStation is its value
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)
Tom Laruve 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.
Tom Laruve 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:
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?
Tom Laruve 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.
Tom Laruve 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.
Tom Laruve 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 ?