我用Visual Studio创建了两个解决方案。我将第一个编译为静态库。我想在第二个解决方案中使用该lib,这是maya的插件。
对于第二个解决方案,我从Autodesk提供的hello world模板文件开始,除了将路径添加到我的lib并包括它之外,没有做太多更改。我一直收到此错误:
Severity Code Description Project File Line Suppression State
Error LNK1120 2 unresolved externals ddRbf C:\Users\daniele\Documents\workspace\ddPlugins\ddRbf\x64\Release\ddRbf.mll 1
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol "public: void __cdecl ddMatrix::print(void)const " (?print@ddMatrix@@QEBAXXZ) referenced in function "public: virtual class Autodesk::Maya::OpenMaya20180000::MStatus __cdecl ddRbf::compute(class Autodesk::Maya::OpenMaya20180000::MPlug const &,class Autodesk::Maya::OpenMaya20180000::MDataBlock &)" (?compute@ddRbf@@UEAA?AVMStatus@OpenMaya20180000@Maya@Autodesk@@AEBVMPlug@345@AEAVMDataBlock@345@@Z) ddRbf C:\Users\daniele\Documents\workspace\ddPlugins\ddRbf\ddRbf.obj 1
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol "public: __cdecl ddMatrix::ddMatrix(class std::vector<class std::vector<double,class std::allocator<double> >,class std::allocator<class std::vector<double,class std::allocator<double> > > >)" (??0ddMatrix@@QEAA@V?$vector@V?$vector@NV?$allocator@N@std@@@std@@V?$allocator@V?$vector@NV?$allocator@N@std@@@std@@@2@@std@@@Z) referenced in function "public: virtual class Autodesk::Maya::OpenMaya20180000::MStatus __cdecl ddRbf::compute(class Autodesk::Maya::OpenMaya20180000::MPlug const &,class Autodesk::Maya::OpenMaya20180000::MDataBlock &)" (?compute@ddRbf@@UEAA?AVMStatus@OpenMaya20180000@Maya@Autodesk@@AEBVMPlug@345@AEAVMDataBlock@345@@Z) ddRbf C:\Users\daniele\Documents\workspace\ddPlugins\ddRbf\ddRbf.obj 1
经过大量研究和测试,我发现如果将项目属性> general>项目默认值>配置从动态链接库更改为静态,它将进行编译,尽管此时我尝试加载已编译的.mll文件在Maya中出现此错误:
// Error: file: C:/Program Files/Autodesk/Maya2018/scripts/others/pluginWin.mel line 290: Unable to dynamically load : C:/Users/daniele/Documents/maya/plug-ins/ddRbf.mll
// Error: file: C:/Program Files/Autodesk/Maya2018/scripts/others/pluginWin.mel line 290: (ddRbf) //
所以我猜想解决方案是将第一个.sln文件编译为动态链接库,但是我想知道是否有一种方法可以只使用静态库而不必执行该步骤。
谢谢!
答案 0 :(得分:1)
我发现了问题,我将库编译为x86,将插件编译为x64。我现在都编译为x64,并且可以正常工作。