Archived

This topic is now archived and is closed to further replies.

Maya plugin sadness

This topic is 5042 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m trying to make a file translator for maya, using the tools that come with devc++. Everything compiles fine, but I get a bunch of linker errors (even after I tried the pexports/dlltool trick). Any help on getting this to work? Here''s the code:
#define NT_PLUGIN
#define _BOOL

#include<stdio.h>

#include<maya/MFnPlugin.h>
#include<maya/MPxFileTranslator.h>

//#include"dMDL.hpp"


#define VERSION_MAJOR 1
#define VERSION_MINOR 0
#define VERSION_STRING "1.0"

class dMDLtranslator:public MPxFileTranslator
{
   MStatus status;
public:
                 dMDLtranslator(){};
   virtual      ~dMDLtranslator(){};
   static void*  creator();
   MStatus       reader(const MFileObject& file,const MString& optionsString,FileAccessMode mode);
   MStatus       writer(const MFileObject& file,const MString& optionsString,FileAccessMode mode);
   bool          haveReadMethod() const;
   bool          haveWriteMethod() const;
   bool          haveNamespaceSupport() const;
   MString       defaultExtension() const;
   MString       filter() const;
   bool          canBeOpened() const;
   MFileKind     identifyFile(const MFileObject& file,const char* buffer,short size) const;
};

void* dMDLtranslator::creator()
{
   return new dMDLtranslator();
}

MStatus dMDLtranslator::reader(const MFileObject& file,const MString& optionsString,FileAccessMode mode)
{
   return MS::kSuccess;
}

MStatus dMDLtranslator::writer(const MFileObject& file,const MString& optionsString,FileAccessMode mode)
{
   return MS::kSuccess;
}

bool dMDLtranslator::haveReadMethod() const
{
   return true;
}

bool dMDLtranslator::haveWriteMethod() const
{
   return true;
}

bool dMDLtranslator::haveNamespaceSupport() const
{
   return false;
}

MString dMDLtranslator::defaultExtension() const
{
   return "mdl";
}

MString dMDLtranslator::filter() const
{
   return "*.mdl";
}

bool dMDLtranslator::canBeOpened() const
{
   return true;
}

MPxFileTranslator::MFileKind dMDLtranslator::identifyFile(const MFileObject& file,const char* buffer,short size) const
{
   char id[4] = {buffer[0],buffer[1],buffer[2],buffer[3]};
   char v = buffer[4];
   if(strcmp(id,"DMDL"))
      return kNotMyFileType;
   if(v != VERSION_MAJOR)
      return kCouldBeMyFileType;
   return kIsMyFileType;
}

MStatus initializePlugin(MObject obj)
{
   MStatus status;
   MFnPlugin plugin(obj,"Universe Industries",VERSION_STRING,"Any");
   status = plugin.registerFileTranslator("Discordia MDL Translator",0,dMDLtranslator::creator,0,0,false);
   if(!status)
      status.perror("registerFileTranslator failed");
   return status;
}

MStatus uninitializePlugin(MObject obj)
{
   MStatus status;
   MFnPlugin plugin(obj);
   status = plugin.deregisterFileTranslator("Discordia MDL Translator");
   if(!status)
      status.perror("deregisterFileTranslator failed");
   return status;
}
and the log:
Compiler: Default compiler
Building Makefile: "C:\dev\creation\work\discordia\Makefile.win"
Finding dependencies for file: C:\dev\creation\work\discordia\dMDLtranslator.cpp
Executing  make...
make.exe -f "C:\dev\creation\work\discordia\Makefile.win" all
dllwrap.exe --output-def libdMDLtranslator.def --driver-name c++ --implib libdMDLtranslator.a ../discordia/dMDLtranslator.o  -L"C:/dev/devcpp/lib" -lfoundation -lopenmaya --no-export-all-symbols --add-stdcall-alias  -o dMDLtranslator.mll

../discordia/dMDLtranslator.o(.text+0x85):dMDLtranslator.cpp: undefined reference to `MPxFileTranslator::MPxFileTranslator()''
../discordia/dMDLtranslator.o(.text+0x96):dMDLtranslator.cpp: undefined reference to `MStatus::MStatus()''
../discordia/dMDLtranslator.o(.text+0xad):dMDLtranslator.cpp: undefined reference to `MPxFileTranslator::~MPxFileTranslator()''
../discordia/dMDLtranslator.o(.text+0xee):dMDLtranslator.cpp: undefined reference to `MStatus::MStatus(MStatus::MStatusCode)''
../discordia/dMDLtranslator.o(.text+0x10e):dMDLtranslator.cpp: undefined reference to `MStatus::MStatus(MStatus::MStatusCode)''
../discordia/dMDLtranslator.o(.text+0x161):dMDLtranslator.cpp: undefined reference to `MString::MString(char const*)''

../discordia/dMDLtranslator.o(.text+0x191):dMDLtranslator.cpp: undefined reference to `MString::MString(char const*)''
../discordia/dMDLtranslator.o(.text+0x284):dMDLtranslator.cpp: undefined reference to `MStatus::MStatus()''
../discordia/dMDLtranslator.o(.text+0x2a1):dMDLtranslator.cpp: undefined reference to `MFnPlugin::MFnPlugin(MObject&, char const*, char const*, char const*, MStatus*)''
../discordia/dMDLtranslator.o(.text+0x2bd):dMDLtranslator.cpp: undefined reference to `MString::MString(char const*)''
../discordia/dMDLtranslator.o(.text+0x2cb):dMDLtranslator.cpp: undefined reference to `MFnPlugin::registerFileTranslator(MString const&, char*, void* (*)(), char*, char*, bool)''
../discordia/dMDLtranslator.o(.text+0x2d8):dMDLtranslator.cpp: undefined reference to `MStatus::operator=(MStatus const&)''
../discordia/dMDLtranslator.o(.text+0x2e0):dMDLtranslator.cpp: undefined reference to `MString::~MString()''
../discordia/dMDLtranslator.o(.text+0x2f2):dMDLtranslator.cpp: undefined reference to `MFnPlugin::~MFnPlugin()''

../discordia/dMDLtranslator.o(.text+0x30e):dMDLtranslator.cpp: undefined reference to `MStatus::perror(char const*) const''
../discordia/dMDLtranslator.o(.text+0x31e):dMDLtranslator.cpp: undefined reference to `MString::~MString()''
../discordia/dMDLtranslator.o(.text+0x32e):dMDLtranslator.cpp: undefined reference to `MFnPlugin::~MFnPlugin()''
../discordia/dMDLtranslator.o(.text+0x391):dMDLtranslator.cpp: undefined reference to `MStatus::MStatus()''
../discordia/dMDLtranslator.o(.text+0x3ae):dMDLtranslator.cpp: undefined reference to `MFnPlugin::MFnPlugin(MObject&, char const*, char const*, char const*, MStatus*)''
../discordia/dMDLtranslator.o(.text+0x3be):dMDLtranslator.cpp: undefined reference to `MString::MString(char const*)''
../discordia/dMDLtranslator.o(.text+0x3cc):dMDLtranslator.cpp: undefined reference to `MFnPlugin::deregisterFileTranslator(MString const&)''
../discordia/dMDLtranslator.o(.text+0x3d9):dMDLtranslator.cpp: undefined reference to `MStatus::operator=(MStatus const&)''
../discordia/dMDLtranslator.o(.text+0x3e1):dMDLtranslator.cpp: undefined reference to `MString::~MString()''
../discordia/dMDLtranslator.o(.text+0x3f3):dMDLtranslator.cpp: undefined reference to `MFnPlugin::~MFnPlugin()''
../discordia/dMDLtranslator.o(.text+0x40f):dMDLtranslator.cpp: undefined reference to `MStatus::perror(char const*) const''
../discordia/dMDLtranslator.o(.text+0x41f):dMDLtranslator.cpp: undefined reference to `MString::~MString()''
../discordia/dMDLtranslator.o(.text+0x42f):dMDLtranslator.cpp: undefined reference to `MFnPlugin::~MFnPlugin()''
../discordia/dMDLtranslator.o(.text$_ZN14dMDLtranslatorD1Ev+0x11):dMDLtranslator.cpp: undefined reference to `MPxFileTranslator::~MPxFileTranslator()''
../discordia/dMDLtranslator.o(.text$_ZN14dMDLtranslatorD0Ev+0x12):dMDLtranslator.cpp: undefined reference to `MPxFileTranslator::~MPxFileTranslator()''

dllwrap.exe: no export definition file provided.
Creating one, but that may not be what you want
dllwrap.exe: c++ exited with status 1

make.exe: *** [dMDLtranslator.mll] Error 1

Execution terminated

My thanks in advance for any advice. I''ve been working on this for the past 24 hours almost continuously (whinewhine).

Share this post


Link to post
Share on other sites