I have an MPxNode and an MPxCommand in a plugin I can't compile due to three LNK2005 errors.
1>pluginMain.obj : error LNK2005: DllMain already defined in UVDeformer.obj
1>pluginMain.obj : error LNK2005: MApiVersion already defined in UVDeformer.obj
1>pluginMain.obj : error LNK2005: "struct HINSTANCE__ * MhInstPlugin" (?MhInstPlugin@@3PEAUHINSTANCE__@@EA) already defined in UVDeformer.obj
I have cmake and my project set up the same way I normally would but this is the first time I've tried to put two tools(node and command) into the same plug-in. What would I need to change to keep these things from writing to the .obj twice?
Solved! Go to Solution.
Solved by dan.norris.25. Go to Solution.
I figured this out one.
I was including MFnPlugin.h to a source file as well as the pluginMain.cpp
Thread necro so people in the future know how to solve this.
The error results from including "MFnPlugin.h" in multiple translation units. I.e. you have more than one .cpp file which, directly or indirectly, includes this header. Most header files exclusively make symbol declarations. This one however unusually contains a symbol definition: PLUGIN_EXPORT char MApiVersion[] = #_version. This makes it unsafe to include in multiple translation units resulting in a multiple symbol definition (LNK2005).
To fix this error, either:
#define MNoVersionString
#include <maya/MFnPlugin.h>
Can't find what you're looking for? Ask the community or share your knowledge.