Community
I wrote a maya shader node and want to make an extension for this node to make it renderable in Arnold, I use Visual Studio 2017 and Maya 2017 SP4, I have lib, include properly set, dll as output format, but once I include "NodeTranslator.h", my dll can't be compiled and shown error message below:
Arnold SDK version 5.0.2.0
error LNK2001: unresolved external symbol "__declspec(dllimport) public: class MNodeClass & __cdecl MNodeClass::operator=(class MNodeClass &&)" (__imp_??4MNodeClass@@QEAAAEAV0@$$QEAV0@@Z)
error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl MNodeClass::MNodeClass(class MNodeClass &&)" (__imp_??0MNodeClass@@QEAA@$$QEAV0@@Z)
Update : I found once a class defined by DLLEXPORT use a maya class like MNodeClass, this problem will occur, I thought during compiling, maya class tried to find a dynamic library, but it failed.
class DLLEXPORT CExtensionAttrHelper : public CBaseAttrHelper { public: /// @param mayaNodeClassName name of maya class to add attributes to /// @param arnoldNodeEntry arnold node entry to use when checking parameter metadata CExtensionAttrHelper(MString mayaNodeClassName, const AtNodeEntry* arnoldNodeEntry = NULL, const MString& prefix = "ai_", bool addCommonAttributes = true) : CBaseAttrHelper(arnoldNodeEntry, prefix), m_class(mayaNodeClassName) { if (MTypeId(MFn::kInvalid) == m_class.typeId()) { AiMsgWarning("[mtoa.attr] CExtensionAttrHelper was passed an unknown Maya node type \"%s\"", mayaNodeClassName.asChar()); } if (addCommonAttributes) AddCommonAttributes(); } /// @param mayaNodeClassName name of maya class to add attributes to /// @param arnoldNodeEntryName arnold node entry to use when checking parameter metadata CExtensionAttrHelper(MString mayaNodeClassName, const MString& arnoldNodeEntryName, const MString& prefix = "ai_", bool addCommonAttributes = true) : CBaseAttrHelper(arnoldNodeEntryName, prefix), m_class(mayaNodeClassName) { if (MTypeId(MFn::kInvalid) == m_class.typeId()) { AiMsgWarning("[mtoa.attr] CExtensionAttrHelper was passed an unknown Maya node type \"%s\"", mayaNodeClassName.asChar()); } /* FIXME : commenting out because of light portals which dump a warning here. Verify what has to be done ! if (m_nodeEntry == NULL) { AiMsgWarning("[mtoa.attr] CExtensionAttrHelper was passed an unknown Arnold node type \"%s\" for Maya node type \"%s\"", arnoldNodeEntryName.asChar(), mayaNodeClassName.asChar()); }*/ if (addCommonAttributes) AddCommonAttributes(); } MString GetMayaNodeTypeName() const {return m_class.typeName();} protected: MStatus virtual addAttribute(MObject& attrib); protected: void AddCommonAttributes(); MNodeClass m_class; };