[MSCE C++]创建ItemType

在编译的过程中,会报ItemType和CustomType未定义的问题。

代码如下

头文件包含如下

mke文件如图所示

希望老师能够帮忙解答!

Parents
  • 因为构造函数在头文件中没有给出定义,所以您不能声明其实例去使用,只能通过指针或者引用来使用

    Answer Verified By: xz h 

  • 郭老师,现在又遇到了一个问题,在创建的时候,先创建ItemTypeLibrary,一直创建的结构都为空。

        DgnFileP dgnFileP = ISessionMgr::GetActiveDgnFile();
    	DgnFileR dgnFile = *dgnFileP;
    	WString itemLibraryName = L"GongCheng";
    	WString itemTypeName = L"ShuXing";
    	
    	ItemTypeLibraryPtr itemTypeLibraryPtr=NULL;
    	itemTypeLibraryPtr->FindByName(itemLibraryName.GetWCharCP(), *dgnFileP);
        //itemTypeLibraryPtr = ItemTypeLibrary::FindByName(itemLibraryName.GetWCharCP(), *dgnFileP);
    	
    	if (NULL==itemTypeLibraryPtr.IsNull())
    	{
    		itemTypeLibraryPtr->Create(itemLibraryName.GetWCharCP(), dgnFile, true);
    	    //itemTypeLibraryPtr=ItemTypeLibrary::Create(itemLibraryName.GetWCharCP(), dgnFile);
    	}
    	ItemTypeLibrary& itemTypeLibrary = *itemTypeLibraryPtr.get();

Reply
  • 郭老师,现在又遇到了一个问题,在创建的时候,先创建ItemTypeLibrary,一直创建的结构都为空。

        DgnFileP dgnFileP = ISessionMgr::GetActiveDgnFile();
    	DgnFileR dgnFile = *dgnFileP;
    	WString itemLibraryName = L"GongCheng";
    	WString itemTypeName = L"ShuXing";
    	
    	ItemTypeLibraryPtr itemTypeLibraryPtr=NULL;
    	itemTypeLibraryPtr->FindByName(itemLibraryName.GetWCharCP(), *dgnFileP);
        //itemTypeLibraryPtr = ItemTypeLibrary::FindByName(itemLibraryName.GetWCharCP(), *dgnFileP);
    	
    	if (NULL==itemTypeLibraryPtr.IsNull())
    	{
    		itemTypeLibraryPtr->Create(itemLibraryName.GetWCharCP(), dgnFile, true);
    	    //itemTypeLibraryPtr=ItemTypeLibrary::Create(itemLibraryName.GetWCharCP(), dgnFile);
    	}
    	ItemTypeLibrary& itemTypeLibrary = *itemTypeLibraryPtr.get();

Children