PDA

View Full Version : Linker errors for developing Maya plugin with Qt 4.6



dythim
5th May 2010, 20:38
Hello, I am trying to write a simple plugin for Maya 2011 using Qt 4.6
Right now it is failing at the linking stage, saying 12 or so references are not defined.

Here is the header file of the plugin:

#include <windows.h>
#include <maya/MPxCommand.h>
#include <maya/MGlobal.h>

class MArgList;

class myMelCmd : public MPxCommand
{

public:
myMelCmd();
virtual ~myMelCmd();

MStatus doIt( const MArgList& );
MStatus redoIt();
MStatus undoIt();
bool isUndoable() const;

static void* creator();
};

I get errors of the following type from mingw32:

debug/testqtplugin.o:C:\Qt\TestQtPlugin/testqtplugin.cpp:28: undefined reference to `_imp___ZN7MStatusC1ENS_11MStatusCodeE'
debug/testqtplugin.o:C:\Qt\TestQtPlugin/testqtplugin.cpp:57: undefined reference to `_imp___ZN10MPxCommand9setResultEPKc'
debug/testqtplugin.o:C:\Qt\TestQtPlugin/testqtplugin.cpp:59: undefined reference to `_imp___ZN7MStatusC1ENS_11MStatusCodeE'
debug/testqtplugin.o:C:\Qt\TestQtPlugin/testqtplugin.cpp:80: undefined reference to `_imp___ZN7MStringC1EPKc'
debug/testqtplugin.o:C:\Qt\TestQtPlugin/testqtplugin.cpp:80: undefined reference to `_imp___ZN7MGlobal11displayInfoERK7MString'
debug/testqtplugin.o:C:\Qt\TestQtPlugin/testqtplugin.cpp:80: undefined reference to `_imp___ZN7MStringD1Ev'
debug/testqtplugin.o:C:\Qt\TestQtPlugin/testqtplugin.cpp:82: undefined reference to `_imp___ZN7MStatusC1ENS_11MStatusCodeE'
debug/testqtplugin.o:C:\Qt\TestQtPlugin/testqtplugin.cpp:80: undefined reference to `_imp___ZN7MStringD1Ev'
debug/testqtplugin.o: In function `myMelCmd':
C:\Qt\TestQtPlugin/testqtplugin.cpp:98: undefined reference to `_imp___ZN10MPxCommandC2Ev'
C:\Qt\TestQtPlugin/testqtplugin.cpp:98: undefined reference to `_imp___ZN10MPxCommandC2Ev'
debug/testqtplugin.o: In function `~myMelCmd':
C:\Qt\TestQtPlugin/testqtplugin.cpp:111: undefined reference to `_imp___ZN10MPxCommandD2Ev'
C:\Qt\TestQtPlugin/testqtplugin.cpp:111: undefined reference to `_imp___ZN10MPxCommandD2Ev'
C:\Qt\TestQtPlugin/testqtplugin.cpp:111: undefined reference to `_imp___ZN10MPxCommandD2Ev'
debug/testqtplugin.o:testqtplugin.cpp:(.rdata$_ZTV8myMel Cmd[vtable for myMelCmd]+0x20): undefined reference to `MPxCommand::hasSyntax() const'
collect2: ld returned 1 exit status

And here are those class definitions. Each of them is underlined in red and says "unexpected token '<classname>'"

#ifndef OPENMAYA_EXPORT
#define OPENMAYA_EXPORT _declspec( dllimport )
#endif // OPENMAYA_EXPORT

class OPENMAYA_EXPORT MStatus
class OPENMAYA_EXPORT MPxCommand
class OPENMAYA_EXPORT MGlobal
class OPENMAYA_EXPORT MString


Can anyone offer any help about what to do about this?