I am trying to derive a class from AcTrayItem, as indicated in the documentation, but even the simplest class that calls Add, Remove or Update on the status bar will not compile - it shows a linker error referencing AcTrayItemAnimationControl. When I go to the docs for that clas, it says for internal use only. I am compiling for AutoCAD 2010, but AcTrayItem hasbeen available since AutoCAD 2007 and the 2013 documentation shows no new material on how to use it.
Can anyone suggest how to overcome this linker error? It appears to be caused by the destructor of the AcTrayItem class.
(Simply try deriving your own class from AcTrayItem and compile it.)
Solved! Go to Solution.
Solved by owenwengerd. Go to Solution.
I've created a brand new project using the ObjectARX wizards for VS 2008 / AutoCAD 2012, and added the derived AcTrayItem class. Same problem. The project is attached. It is listing acad.lib and acedapi.lib for linking. The latter lib is the one that mentions AcTrayItemAnimationControl but I still get this linker error:
(32-bit Debug compile: )
Error 1 error LNK2019: unresolved external symbol "public: __thiscall AcTrayItemAnimationControl::~AcTrayItemAnimationControl(void)" (??1AcTrayItemAnimationControl@@QAE@XZ) referenced in function __unwindfunclet$??0AcTrayItem@@QAE@ABV0@@Z$0 ConDTrayIcon.obj
(64-bit Debug compile: )
Error 1 error LNK2019: unresolved external symbol "public: __cdecl AcTrayItemAnimationControl::~AcTrayItemAnimationControl(void)" (??1AcTrayItemAnimationControl@@QEAA@XZ) referenced in function "int `public: __cdecl AcTrayItem::AcTrayItem(class dtor$1 const &)'::`1'::dtor$1" (?dtor$1@?0???0AcTrayItem@@QEAA@AEBV0@@Z@4HA) ConDTrayIcon.obj
It does appear that Autodesk forgot to include the implementation of the AcTrayItemAnimationControl destructor. It looks to me like the desctuctor can be optimized out under normal circumstances, but your AFX_EXT_CLASS macro forces it to be implemented. After removing the AFX_EXT_CLASS macro, your code compiles and links without error.
If you must export the class, just add a do-nothing destructor implementation in one of your source files:
AcTrayItemAnimationControl::~AcTrayItemAnimationControl() {}
Brilliant, thank you for taking the time to look at this.
(I didn't know I could simply define my own destructor for their class - thought that would create all kinds of havoc!)