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.
But, these versions are not available anymore, so is it impossible to develop ?
If you are an MSDN subscriber, go to MSDN Subscriber Downloads at msdn.microsoft.com/.../securedownloads and enter "Visual Studio 2005 Professional" in the search box.
Yes, I just tried with Visual Studio 2005, but I have exactly the same errors than my first post into this thread. So I wanted to try with others, but it's impossible.
Tom Laruve said:Yes, I just tried with Visual Studio 2005, but I have exactly the same errors than my first post into this thread. So I wanted to try with others, but it's impossible.
Sorry, but it's completely wrong way of thinking! If the only recommended compiler version doesn't work, is the right solution to try unsupported versions instead of to hunt for the source of the problem and to solve it?
To better understand you environment and configuration: You compile your code using bmake, started from MicroStation SDK development shell, or you use other approach?
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Tom Laruve said:With Visual Studio 2005 I have exactly the same errors as my first post
It's hard to tell without seeing your code, but I suspect you don't have the right header files #included. When the C++ compiler tells you about 'default int' and 'undefined type' then usually a header file is missing.
Take a look at the MDL examples delivered with the SDK. With MicroStation V8i they all use .cpp implementation files and are built using bmake.exe. If you look in the .h and .cpp files for #include statements, that may show you what you have left out.
Thank you Jan and Jon for your answers.
I managed to make it work by adding the #include <MicrostationAPI.h> and the #define winNT
But after some tests I don't seem to be able to load a dgn file, I've used the DgnFile class but I don't think it's the right one.
What are you suggesting to be able to simply load a dgn file and dump its elements ?
Thank you again for your help.
Tom Laruve said:What are you suggesting to be able to simply load a dgn file and dump its elements?
A design file contains models, not elements. A DGN file has a collection of DgnModelRefs. If you want elements, then you work with a DgnModelRef.
Thanks Jon, I just added this line:
int fd = mdlSystem_newDesignFile("toto.dgn");
And then the linker returns:
unresolved external symbol _mdlSystem_newDesignFile
The only lib folder I added into the linker path is:
Should I add something else ?
Tom Laruve said:The only lib folder I added into the linker path is:
How do you compile your code? Do you use the standard MicroStation SDK way, which means to create own bmake .mke file (which is preferred) or you try to use Visual Studio compilation?
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.
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.