iCAx开思工具箱

标题: catia二次开发 连接错误,请路过高手帮忙看看【此错误已解决,内附方法,类似情况参考 [打印本页]

作者: www_    时间: 2012-4-5 16:24
标题: catia二次开发 连接错误,请路过高手帮忙看看【此错误已解决,内附方法,类似情况参考


请给位用过的大侠们,帮忙看看,谢谢了{:soso_e181:}

MyNewAddin3.h头文件定义
// COPYRIGHT Dassault Systemes 2010
//===================================================================
//
// MyNewAddin3.h
// Provide implementation to interface
//    CATIPrtWksAddin

//
//===================================================================
//
// Usage notes:
//
//===================================================================
//CAA2 Wizard Generation Report
//IMPLEMENTATION
//    TIE: CATIPrtWksAddin

//End CAA2 Wizard Generation Report
//
//  Mar 2010  Creation: Code generated by the CAA wizard  Administrator
//===================================================================
#ifndef MyNewAddin3_H
#define MyNewAddin3_H

#include "CATBaseUnknown.h"
#include "CATCmdContainer.h"

//-----------------------------------------------------------------------

/**
* Class representing xxx.
*
* <br><b>Role</b>: Provide the basic class function...
* <p>
* It implements the interfaces :
*  <ol>
*  <li>@href CATIPrtWksAddin
*  </ol>
*
* @href ClassReference, Class#MethodReference, #InternalMethod...
*/
class MyNewAddin3: public CATBaseUnknown
//class MyNewAddin3: public CATIWorkbenchAddin

{
  CATDeclareClass;

  public:

  // Standard constructors and destructors for an implementation class
  // -----------------------------------------------------------------
     MyNewAddin3 ();
     virtual ~MyNewAddin3 ();


  private:
  // The copy constructor and the equal operator must not be implemented
  // -------------------------------------------------------------------
  MyNewAddin3 (MyNewAddin3 &);
  MyNewAddin3& operator=(MyNewAddin3&);

public:

        void CreateCommands();
        CATCmdContainer * CreateToolbars();


};

//-----------------------------------------------------------------------

#endif


MyNewAddin3.cpp定义
// COPYRIGHT Dassault Systemes 2010
//===================================================================
//
// MyNewAddin3.cpp
// Provide implementation to interface
//    CATIPrtWksAddin
//
//===================================================================
//
// Usage notes:
//
//===================================================================
//  Mar 2010  Creation: Code generated by the CAA wizard  Administrator
//===================================================================
#include "MyNewAddin3.h"
#include "CATCreateWorkshop.h"

#include "CATCommandHeader.h"
MacDeclareHeader(PartCmdHeader);

CATImplementClass(MyNewAddin3,
                  Implementation,
                  CATBaseUnknown,
                  CATnull );


//-----------------------------------------------------------------------------
// MyNewAddin3 : constructor
//-----------------------------------------------------------------------------
MyNewAddin3::MyNewAddin3():
    CATBaseUnknown()
{
}

//-----------------------------------------------------------------------------
// MyNewAddin3 : destructor
//-----------------------------------------------------------------------------
MyNewAddin3::~MyNewAddin3()
{
}

// Link the implementation to its interface
// ---------------------------------------


void MyNewAddin3::CreateCommands()
{
        new PartCmdHeader("point","CmdModule","TestCmd",(void *)NULL);
        new PartCmdHeader("line","CmdModule","LinCmd",(void *)NULL);
}

CATCmdContainer * MyNewAddin3::CreateToolbars()
{
        NewAccess(CATCmdContainer,pPartBenchTlb,PartBenchTlb);
        NewAccess(CATCmdStarter,pPointCmd,PointCmd);
        SetAccessCommand(pPointCmd,"point");
        SetAccessChild(pPartBenchTlb,pPointCmd);
        NewAccess(CATCmdStarter,pLineCmd,LineCmd);
        SetAccessCommand(pLineCmd,"line");
        SetAccessNext(pPointCmd,pLineCmd);

        return NULL;
}


//TIE or TIEchain definitions
#include "TIE_CATIPrtWksAddin.h"
TIE_CATIPrtWksAddin(MyNewAddin3);


//Methods implementation





Imakefile.mk 文件内容如下:
# COPYRIGHT Dassault Systemes 2010
#======================================================================
# Imakefile for module MyFirstModule.m
#======================================================================
#
#  Mar 2010  Creation: Code generated by the CAA wizard  Administrator
#======================================================================
#
# SHARED LIBRARY
#
BUILT_OBJECT_TYPE=SHARED LIBRARY

# DO NOT EDIT :: THE CAA2 WIZARDS WILL ADD CODE HERE
WIZARD_LINK_MODULES = JS0GROUP \
JS0FM JS0GROUP CATMechanicalModelerUI MechanicalModelerUIUUID \
PrtWorkshop
# END WIZARD EDITION ZONE

LINK_WITH = $(WIZARD_LINK_MODULES)

# System dependant variables
#
OS = AIX
#
OS = HP-UX
#
OS = IRIX
#
OS = SunOS
#
OS = Windows_NT


错误信息如下
------ Rebuild All started: Project: MyFirstModule.m, Configuration: Debug Win32 ------
Deleting intermediate and output files for project 'MyFirstModule.m', configuration 'Debug|Win32'
Compiling...
MyNewAddin3.cpp
Linking...
MyNewAddin3.obj : error LNK2019: unresolved external symbol "public: static class CATMetaClass * __cdecl CATCommandHeader::MetaObject(void)" (?MetaObject@CATCommandHeader@@SAPAVCATMetaClass@@XZ) referenced in function "public: static class CATMetaClass * __cdecl PartCmdHeader::MetaObject(void)" (?MetaObject@PartCmdHeader@@SAPAVCATMetaClass@@XZ)
MyNewAddin3.obj : error LNK2001: unresolved external symbol "public: virtual long __thiscall CATBaseUnknown:ueryInterface(struct _GUID const &,void * *)" (?QueryInterface@CATBaseUnknown@@UAEJABU_GUID@@PAPAX@Z)
MyNewAddin3.obj : error LNK2001: unresolved external symbol "public: virtual unsigned long __thiscall CATBaseUnknown::AddRef(void)" (?AddRef@CATBaseUnknown@@UAEKXZ)
MyNewAddin3.obj : error LNK2001: unresolved external symbol "public: virtual unsigned long __thiscall CATBaseUnknown::Release(void)" (?Release@CATBaseUnknown@@UAEKXZ)
MyNewAddin3.obj : error LNK2001: unresolved external symbol "public: virtual long __thiscall CATBaseUnknown::GetTypeInfoCount(unsigned int *)" (?GetTypeInfoCount@CATBaseUnknown@@UAEJPAI@Z)
MyNewAddin3.obj : error LNK2001: unresolved external symbol "public: virtual long __thiscall CATBaseUnknown::GetTypeInfo(unsigned int,unsigned long,struct ITypeInfo * *)" (?GetTypeInfo@CATBaseUnknown@@UAEJIKPAPAUITypeInfo@@@Z)
MyNewAddin3.obj : error LNK2001: unresolved external symbol "public: virtual long __thiscall CATBaseUnknown::GetIDsOfNames(struct _GUID const &,wchar_t * *,unsigned int,unsigned long,long *)" (?GetIDsOfNames@CATBaseUnknown@@UAEJABU_GUID@@PAPA_WIKPAJ@Z)
MyNewAddin3.obj : error LNK2001: unresolved external symbol "public: virtual long __thiscall CATBaseUnknown::Invoke(long,struct _GUID const &,unsigned long,unsigned short,struct tagDISPPARAMS *,struct tagVARIANT *,struct tagEXCEPINFO *,unsigned int *)" (?Invoke@CATBaseUnknown@@UAEJJABU_GUID@@KGPAUtagDISPPARAMS@@PAUtagVARIANT@@PAUtagEXCEPINFO@@PAI@Z)
MyNewAddin3.obj : error LNK2001: unresolved external symbol "public: virtual class CATBaseUnknown * __thiscall CATBaseUnknown::GetImpl(int)const " (?GetImpl@CATBaseUnknown@@UBEPAV1@H@Z)
MyNewAddin3.obj : error LNK2001: unresolved external symbol "public: virtual class CATBaseUnknown * __thiscall CATBaseUnknown::SetImpl(class CATBaseUnknown *)" (?SetImpl@CATBaseUnknown@@UAEPAV1@PAV1@@Z)
MyNewAddin3.obj : error LNK2019: unresolved external symbol "public: static class CATMetaClass * __cdecl CATBaseUnknown::MetaObject(void)" (?MetaObject@CATBaseUnknown@@SAPAVCATMetaClass@@XZ) referenced in function "public: static class CATMetaClass * __cdecl MyNewAddin3::MetaObject(void)" (?MetaObject@MyNewAddin3@@SAPAVCATMetaClass@@XZ)
MyNewAddin3.obj : error LNK2019: unresolved external symbol "struct _GUID IID_CATIPrtWksAddin" (?IID_CATIPrtWksAddin@@3U_GUID@@A) referenced in function "public: static class CATMetaClass * __cdecl TIECATIPrtWksAddinMyNewAddin3::MetaObject(void)" (?MetaObject@TIECATIPrtWksAddinMyNewAddin3@@SAPAVCATMetaClass@@XZ)
MyNewAddin3.obj : error LNK2019: unresolved external symbol "public: static class CATMetaClass * __cdecl CATIPrtWksAddin::MetaObject(void)" (?MetaObject@CATIPrtWksAddin@@SAPAVCATMetaClass@@XZ) referenced in function "public: static class CATMetaClass * __cdecl TIECATIPrtWksAddinMyNewAddin3::MetaObject(void)" (?MetaObject@TIECATIPrtWksAddinMyNewAddin3@@SAPAVCATMetaClass@@XZ)
MyNewAddin3.obj : error LNK2001: unresolved external symbol "public: virtual class CATMetaClass * __thiscall CATBaseUnknown::GetMetaObject(void)const " (?GetMetaObject@CATBaseUnknown@@UBEPAVCATMetaClass@@XZ)
MyNewAddin3.obj : error LNK2019: unresolved external symbol "long __cdecl Tie_GetIDsOfNames(struct IDispatch *,class CATMetaClass *,struct _GUID const &,wchar_t * *,unsigned int,unsigned long,long *)" (?Tie_GetIDsOfNames@@YAJPAUIDispatch@@PAVCATMetaClass@@ABU_GUID@@PAPA_WIKPAJ@Z) referenced in function "public: virtual long __thiscall TIECATIPrtWksAddinMyNewAddin3::GetIDsOfNames(struct _GUID const &,wchar_t * *,unsigned int,unsigned long,long *)" (?GetIDsOfNames@TIECATIPrtWksAddinMyNewAddin3@@UAEJABU_GUID@@PAPA_WIKPAJ@Z)
..\..\..\intel_a\code\bin\MyFirstModule.dll : fatal error LNK1120: 15 unresolved externals
Build log was saved at "file://c:\MyFirstWorkspace\ToolsData\VisualStudio2005\MyFirstFramework\Debug\BuildLog.htm"
MyFirstModule.m - 16 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

作者: www_    时间: 2012-4-5 17:45
{:soso_e100:}
困扰好长时间了,请路过大侠 帮忙看看
方便的话,留下QQ,我把工程发送过去
祝 大家工作顺利
作者: www_    时间: 2012-4-6 09:46
知道的朋友请帮忙指导下,谢谢
作者: linlily0925    时间: 2012-4-6 13:11
你可定义需求空间了啊~~~
287226258,你把工程发给我吧~~~
作者: www_    时间: 2012-4-7 13:23
linlily0925 发表于 2012-4-6 13:11
你可定义需求空间了啊~~~
287226258,你把工程发给我吧~~~

你好,非常感谢你!
我把工程已经发过去给你了,你有时间了,帮忙看看
作者: wfrzbb    时间: 2012-4-8 20:49
看着好难啊,没做过二次开发
作者: www_    时间: 2012-4-9 09:21
wfrzbb 发表于 2012-4-8 20:49
看着好难啊,没做过二次开发

谢谢关注,有解决方法了 及时共享
作者: www_    时间: 2012-4-9 16:41


之前总知道问题出在
Imakefile.mk文件中(因为catia二次开发工程的连接信息,都记录在此文件中),修改此文件中的连接信息以后,仍不见好。
于是参考catia提供的案例(即*.eu工程),自己重新建了个工程,最后发现
连接错误还跟IdentityCard.h中的文件内容有关,最后仿照处理后,编译通过了

我这属于很笨的方法,对其中的原理,并不是很清楚,所以也请路过的高手,不吝赐教
谢谢大家

同时,编译虽通过了,可是调试进入catia环境后,代码中添加的工具条和菜单 出不来
也请路过的大侠们 帮忙看看啥原因 连接如下:

https://www.icax.org/forum.php?mod=viewthread&tid=759291&page=1&extra=#pid10456779


Imakefile.mk 文件内容:
# COPYRIGHT Dassault Systemes 2010
#======================================================================
# Imakefile for module ConfirmModule.m
#======================================================================
#
#  Apr 2010  Creation: Code generated by the CAA wizard  Administrator
#======================================================================
#
# SHARED LIBRARY
#
BUILT_OBJECT_TYPE=SHARED LIBRARY

LINK_WITH=CATApplicationFrame    \
          CATGitInterfaces       \      
          CATMechanicalModelerUI \
          JS0GROUP


IdentityCard.h文件内容如下:
// COPYRIGHT Dassault Systemes 2010
//===================================================================
//
// IdentityCard.h
// Supplies the list of prerequisite components for framework ConfirmFramework
//
//===================================================================
//
// Usage notes:
//   For every prereq framework FW, use the syntax:
//   AddPrereqComponent ("FW", Public);
//
//===================================================================
//
//  Apr 2010  Creation: Code generated by the CAA wizard  Administrator
//===================================================================
// DO NOT EDIT :: THE CAA2 WIZARDS WILL ADD CODE HERE
AddPrereqComponent("ApplicationFrame" ,Public);
AddPrereqComponent("CATIAApplicationFrame" ,Public);
AddPrereqComponent("Dialog" ,Public);
AddPrereqComponent("DialogEngine" ,Public);
AddPrereqComponent("GSMInterfaces" ,Public);
AddPrereqComponent("GeometricObjects" ,Public);
AddPrereqComponent("LiteralFeatures" ,Public);
AddPrereqComponent("KnowledgeInterfaces",Public);// pour la CXR9
AddPrereqComponent("Mathematics" ,Public);
AddPrereqComponent("MecModInterfaces" ,Public);
AddPrereqComponent("MechanicalCommands" ,Public);
AddPrereqComponent("MechanicalModeler" ,Public);
AddPrereqComponent("MechanicalModelerUI" ,Public);
AddPrereqComponent("NewTopologicalObjects" ,Public);
AddPrereqComponent("ObjectModelerBase" ,Public);
AddPrereqComponent("ObjectSpecsModeler" ,Public);
AddPrereqComponent("System" ,Public);
AddPrereqComponent("TopologicalOperators" ,Public);
AddPrereqComponent("Visualization" ,Public);
AddPrereqComponent("VisualizationBase" ,Public);
AddPrereqComponent("ComponentsCatalogsInterfaces",Public);
AddPrereqComponent("InteractiveInterfaces",Public);
AddPrereqComponent("SketcherInterfaces",Public);
// fda bypass link forte 6.1
AddPrereqComponent("ProductStructure" ,Public);
AddPrereqComponent("ProductStructureUI" ,Public);
AddPrereqComponent("CATGraphicProperties", Public);  //Necessary for CAAMmrMultiMeasure & CAAMmrMesureSet Visu impl閙entation

// pcc 15/11/02 - Split MechanicalModeler/ConstraintModeler/ConstraintModelerInterfaces

// END WIZARD EDITION ZONE




作者: yumeng321    时间: 2012-5-30 08:17
CATCmdContainer * MyNewAddin3::CreateToolbars()里面有点问题:
1:在最后一个SetAccessNext后添加:
AddToolbarView(pPartBenchTlb,1,UnDock); // visible toolbar
用来显示工具条。
2:return pPartBenchTlb;而不是return NULL;
作者: 青春的风    时间: 2012-7-1 18:04
:yan::yan::yan:




欢迎光临 iCAx开思工具箱 (https://t.icax.org/) Powered by Discuz! X3.3