PDA

View Full Version : Maya Plugin, VS Express 2005 Compile error


Mydrako
11-05-2008, 06:01 PM
Hey all,
I am trying to start learning plugin programming but slam into a wall immediately.
My system is xp64 with maya 64, vs express 2005.

I tried creating a simple helloworld command but is encountering this error.

1> Creating library testPlugin.lib and object testPlugin.exp
1>pluginTest_03.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall MPxCommand::MPxCommand(void)" (__imp_??0MPxCommand@@QAE@XZ) referenced in function "public: __thiscall testCmd::testCmd(void)" (??0testCmd@@QAE@XZ)
1>pluginTest_03.obj : error LNK2001: unresolved external symbol "public: virtual class MStatus __thiscall MPxCommand::undoIt(void)" (?undoIt@MPxCommand@@UAE?AVMStatus@@XZ)
1>pluginTest_03.obj : error LNK2001: unresolved external symbol "public: virtual class MStatus __thiscall MPxCommand::redoIt(void)" (?redoIt@MPxCommand@@UAE?AVMStatus@@XZ)
1>pluginTest_03.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall MPxCommand::isUndoable(void)const " (?isUndoable@MPxCommand@@UBE_NXZ)
1>pluginTest_03.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall MPxCommand::hasSyntax(void)const " (?hasSyntax@MPxCommand@@UBE_NXZ)
1>pluginTest_03.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall MPxCommand::~MPxCommand(void)" (__imp_??1MPxCommand@@UAE@XZ) referenced in function "public: virtual __thiscall testCmd::~testCmd(void)" (??1testCmd@@UAE@XZ)
1>pluginTest_03.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall MObject::~MObject(void)" (__imp_??1MObject@@QAE@XZ) referenced in function "class MStatus __cdecl initializePlugin(class MObject)" (?initializePlugin@@YA?AVMStatus@@VMObject@@@Z)
1>pluginTest_03.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall MFnPlugin::~MFnPlugin(void)" (__imp_??1MFnPlugin@@UAE@XZ) referenced in function "class MStatus __cdecl initializePlugin(class MObject)" (?initializePlugin@@YA?AVMStatus@@VMObject@@@Z)
1>pluginTest_03.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall MStatus::perror(char const *)const " (__imp_?perror@MStatus@@QBEXPBD@Z) referenced in function "class MStatus __cdecl initializePlugin(class MObject)" (?initializePlugin@@YA?AVMStatus@@VMObject@@@Z)
1>pluginTest_03.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall MString::~MString(void)" (__imp_??1MString@@QAE@XZ) referenced in function "class MStatus __cdecl initializePlugin(class MObject)" (?initializePlugin@@YA?AVMStatus@@VMObject@@@Z)
1>pluginTest_03.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class MStatus __thiscall MFnPlugin::registerCommand(class MString const &,void * (__cdecl*)(void),class MSyntax (__cdecl*)(void))" (__imp_?registerCommand@MFnPlugin@@QAE?AVMStatus@@ABVMString@@P6APAXXZP6A?AVMSyntax@@XZ@Z) referenced in function "class MStatus __cdecl initializePlugin(class MObject)" (?initializePlugin@@YA?AVMStatus@@VMObject@@@Z)
1>pluginTest_03.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall MString::MString(char const *)" (__imp_??0MString@@QAE@PBD@Z) referenced in function "class MStatus __cdecl initializePlugin(class MObject)" (?initializePlugin@@YA?AVMStatus@@VMObject@@@Z)
1>pluginTest_03.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall MFnPlugin::MFnPlugin(class MObject &,char const *,char const *,char const *,class MStatus *)" (__imp_??0MFnPlugin@@QAE@AAVMObject@@PBD11PAVMStatus@@@Z) referenced in function "class MStatus __cdecl initializePlugin(class MObject)" (?initializePlugin@@YA?AVMStatus@@VMObject@@@Z)
1>pluginTest_03.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class MStatus __thiscall MFnPlugin::deregisterCommand(class MString const &)" (__imp_?deregisterCommand@MFnPlugin@@QAE?AVMStatus@@ABVMString@@@Z) referenced in function "class MStatus __cdecl uninitializePlugin(class MObject)" (?uninitializePlugin@@YA?AVMStatus@@VMObject@@@Z)
1>pluginTest_03.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl MPxCommand::setResult(char const *)" (__imp_?setResult@MPxCommand@@SAXPBD@Z) referenced in function "public: virtual class MStatus __thiscall testCmd::doIt(class MArgList const &)" (?doIt@testCmd@@UAE?AVMStatus@@ABVMArgList@@@Z)
1>pluginTest_03.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall MStatus::MStatus(enum MStatus::MStatusCode)" (__imp_??0MStatus@@QAE@W4MStatusCode@0@@Z) referenced in function "public: virtual class MStatus __thiscall testCmd::doIt(class MArgList const &)" (?doIt@testCmd@@UAE?AVMStatus@@ABVMArgList@@@Z)
1>testPlugin.mll : fatal error LNK1120: 16 unresolved externals


I have done all the necessary change to set up vs express 2005 as said in the other thread as well as highend3d thread on this topic. I tried both mayaPluginWizard as well as without but still no luck. I am not sure whats wrong. Hopefully someone can help me with this. Thanks in advance.

Keilun
11-05-2008, 06:17 PM
Sounds like you're missing the Maya libraries in your project configuration.

1. Goto your project properties.

2. In the left pane, select Configuration Properties > Linker > General.

3. Ensure Additional Library Directories includes the \lib\ folder of your Maya install. Eg. ("C:\Program Files\Autodesk\Maya2008\lib\")

4. Select Linker > Input

5. Ensure the Additional Dependencies includes, at the very least:

Foundation.lib
OpenMaya.lib

Mydrako
11-05-2008, 06:30 PM
I have the lib folder in my dependencies list already. :(

Is it anything to do with maya64 running on a xp64? I installed the windows server 2003 platform sdk sp1. Is that correct?

Keilun
11-05-2008, 06:56 PM
There were 2 things to check for. Apart from the lib folder in the additional library directories, do you also have Foundation.lib and OpenMaya.lib in the Additional Dependencies line as mentioned in my previous post?

Mydrako
11-05-2008, 07:02 PM
Yes i have that too :(.

Let me post both the c/c++ commandline and the linker commandline here.

c/c++ commandline
/Od /I "C:\Program Files\Autodesk\Maya2008\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "NT_PLUGIN" /D "REQUIRE_IOSTREAM" /D "_WINDLL" /FD /EHsc /MTd /Fp"Debug/helloWorldCmd.pch" /Fo"Debug\\" /Fd"Debug\vc80.pdb" /W3 /nologo /c /TP /errorReport:prompt

c/c++ additional options:
/Gm /GR /GS /EHsc /Zi /I "." /D "WIN32" /D "_DEBUG" /RTC1 /c

linker commandline
/OUT:"HelloWorldCmd.mll" /NOLOGO /LIBPATH:"C:\Program Files\Autodesk\Maya2008\lib" /DLL /MANIFEST /MANIFESTFILE:"Debug\HelloWorldCmd.mll.intermediate.manifest" /PDB:"Debug/helloWorldCmd.pdb" /IMPLIB:"Debug/helloWorldCmd.lib" /ERRORREPORT:PROMPT Foundation.lib OpenMaya.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib

linker additional options
/subsystem:windows /dll /incremental:yes /debug /export:initializePlugin /export:uninitializePlugin

anyone smell a mistake somewhere?

bazuka
11-05-2008, 07:06 PM
can u send me project, if its not a secret :)

Keilun
11-05-2008, 07:15 PM
In your C/C++ preprocessors, you still have WIN32 preprocessor define. Try using WIN64. Since you're compiling on x64.

Mydrako
11-05-2008, 07:19 PM
Definitely not.. It is just helloworld !! haa :P

http://www.jsneo.com/blog/wp-content/uploads/stuff/HelloWorld.zip

I really suspect it is something to do with my vs express setup. I send it to my friend who is running vs express 2008 on 32bit windows and 32 bit maya and it works.

Can anyone having the same setup as me please help me solve this problem?

Mydrako
11-05-2008, 07:23 PM
In your C/C++ preprocessors, you still have WIN32 preprocessor define. Try using WIN64. Since you're compiling on x64.

Still not working. I am abit confused about these different version. Let me clarify:
On a x64 machine with maya64, you can only compile 64bit plugin? What about maya 32 on a x64 machine?

Since i am on x64 version, is there something i need to set up differently?

bazuka
11-05-2008, 07:36 PM
hold on a sec, im on x64 too...

:)

Keilun
11-05-2008, 07:39 PM
If you're compiling a plug-in for Maya 64-bit, then you need to be building it as a 64-bit plug-in.

If you're compiling a plug-in for Maya 32-bit on XP64, then you need to build it as a 32-bit plug-in.

The bitness needs to match the application you're building against. Your original post indicated you were building against Maya 64 on XP 64, so I assumed you'd be wanting a 64-bit build.

Try going to your Configuration Manager and change your Solution Platform to x64.

bazuka
11-05-2008, 07:46 PM
done :) no errors

1>------ Build started: Project: HelloWorld, Configuration: Release x64 ------
1>Compiling...
1>helloWorldCmd.cpp
1>Linking...
1> Creating library Release/myCmd.lib and object Release/myCmd.exp
1>Embedding manifest...
1>Build log was saved at "file://c:\Temp\HelloWorld\HelloWorld\x64\Release\BuildLog.htm"
1>HelloWorld - 0 error(s), 0 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

http://rapidshare.com/files/160991176/HelloWorld.rar.html

have fun :)

Mydrako
11-06-2008, 02:27 AM
Thanks for clarifying everything. I went to research on compiling for 64bit plugin using vs express. There seem to be alot of things to set up so I decide to install maya 2008 32bit version and compile against it, and everything works perfectly :)

Robert Bateman
11-06-2008, 11:39 AM
Thanks for clarifying everything. I went to research on compiling for 64bit plugin using vs express. There seem to be alot of things to set up so I decide to install maya 2008 32bit version and compile against it, and everything works perfectly :)

goto your linker->advanced settings, and change the Target Machine to x64. then just change the library paths in Linker->General to the 64bit versions. Compile and you're done.

Mydrako
11-06-2008, 05:34 PM
Oh didnt know that. There is so many settings in visual studio. They confuse the hell out of me. Anyway, thanks u :)

bazuka
11-06-2008, 06:26 PM
man just dl the file i send u and u will see everything they talked about...

cheers

Mydrako
11-06-2008, 08:53 PM
man just dl the file i send u and u will see everything they talked about...

I cant open your project. I think you are using vs 2008 right? I using 2005 only. Anyway thanks, i sort of figure out what to do.

bazuka
11-07-2008, 06:03 AM
yeah :) shit i forgot that...

ticket01
11-07-2008, 08:28 AM
You are aware of the fact that in order to compile for a 64bit target in VC++ Express you need to install the .NET Framework SDK?

Otherwise there won't be any 64bit tools available. Apart from that it's not sufficient to set the machine architecture to x64 but rather to create a new x64 configuration.

Read about it here (http://msdn.microsoft.com/en-us/library/9yb4317s%28VS.80%29.aspx).

Good luck.

PS: Think about at least using VS Standard. You get a lot more for a few bucks than in the Express editions.

Mydrako
11-07-2008, 08:49 PM
Thanks for the info. Well now that i have already installed maya 32 bit back on my machine, i think i will just continue learning plugin programming using that. I am still a student so I am going to stick with express version until i get some salary under my belt. :)

CGTalk Moderation
11-07-2008, 08:49 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.