Trying to set up plug-in dev env for Qt 4.6

Trying to set up plug-in dev env for Qt 4.6

Anonymous
Not applicable
450 Views
3 Replies
Message 1 of 4

Trying to set up plug-in dev env for Qt 4.6

Anonymous
Not applicable
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.

I have taken the auto-generated plug-in code from Visual Studio and imported it into Qt Creator, and then added in the necessary include and library files as follows:
QT -= core \
gui
TARGET = myMelCmd.mll
TEMPLATE = lib
SOURCES += testqtplugin.cpp
HEADERS += testqtplugin.h

DEFINES += TESTQTPLUGIN_LIBRARY \
_BOOL \
WIN32 \
REQUIRE_IOSTREAM
INCLUDEPATH += -I "C:/Program Files/Autodesk/Maya2011/include/"
LIBS += -L "C:/Program Files/Autodesk/Maya2011/lib" \
-lOpenMaya \
-lFoundation


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+0x20): undefined reference to `MPxCommand::hasSyntax() const'
collect2: ld returned 1 exit status
======================================================================================

All of the classes seem to have the same export declaration, but I'm not sure why it is failing.
Here is a quick summary of the class signatures:
#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


Does anyone have any insight? Much appreciated.
0 Likes
451 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
I don't know if using Qt 4.6 is going to work, since Maya is using Qt 4.5.3 with some patches made by Autodesk. What I did was compile the patched Qt sources from the Maya DVD to obtain lib files (check the included howToBuildOn*.txt files), then included the headers from those sources. I used Visual Studio on Windows, I don't know about setting it up for mingw. Building wasn't necessary on OSX, where I linked directly with Maya.app/Contents/MacOS/QtGui and such.
0 Likes
Message 3 of 4

Christoph_Schaedl
Mentor
Mentor
think you have to use Qt 4.5.3
http://qt.nokia.com/qt-in-use/autodesk
----------------------------------------------------------------
https://linktr.ee/cg_oglu
0 Likes
Message 4 of 4

Anonymous
Not applicable
Yes, you are correct.

I figured that out a while ago (after completely giving up on these forums :P).

Thanks for the replies!
0 Likes