I have a function in SS3 that accepts a pointer to a TextEDParam structure.
In CONNECT, I added the include file
#include <DgnPlatform\TextParam.h>
This include file looks like it defines TextEDParam. (in SS3 it was defined in mdl.h)
Yet for this function:
Public nativeCode void fplcom_justTxtToEditField(TextEDParam *edParam);
I am getting this compiler error: error C2065: 'TextEDParam': undeclared identifier
Any idea what is going wrong here?
Ken Adams said:I am getting this compiler error: error C2065: 'TextEDParam': undeclared identifier
C++ namespaces are used throughout the SDK. struct TextEDParam is defined within the DgnPlatform namespace (see BEGIN_BENTLEY_DGNPLATFORM_NAMESPACE in that file).Either use the namespace at the beginning of your file (see the SDK examples) or qualify the struct name with the relevant namespace e.g. DgnPlatform::TextEDParam.
TextEDParam
DgnPlatform
BEGIN_BENTLEY_DGNPLATFORM_NAMESPACE
DgnPlatform::TextEDParam
Look at the SDK examples. Bentley have defined a number of macros that help declare a namespace and use a namespace: see DgnPlatform/DgnPlatform.h. You'll see ubiquitous statements like this near the beginning of many source files...
DgnPlatform/DgnPlatform.h
USING_NAMESPACE_BENTLEY_DGNPLATFORM;
Regards, Jon Summers LA Solutions
Could this be a similar case? error C2065: 'UnitInfo': undeclared identifier
It looks like it is defined in <DgnPlatform\DgnFileIO\UnitDefinition.h> but that does not fix the error.
The only SDK example I see that uses this type is steel which does not compile for me.
Hi Ken,
Ken Adams said:Could this be a similar case? error C2065: 'UnitInfo': undeclared identifier
maybe. But without context and more details, it's hard to say.
Did you read a description of this error? It provides hints what can cause this problem.
Ken Adams said:It looks like it is defined in <DgnPlatform\DgnFileIO\UnitDefinition.h> but that does not fix the error.
You must change your thinking from C to C++, where - as Jon wrote - everything resides in (some) namespace. So to include the header is not usually enough, and you must ensure the proper namespace is used. MicroStation SDK makes this process simpler through predefined USING_NAMESPACE_xyz macros.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point