I seem to be having a very similar issue as Audu, but I believe the source of my issue is slightly different. I am trying to build a plugin based on the fatigue muscle example Code/CPP/MuscleExample. I am using the FatigableMuscle.cpp and FatigableMuscle.h in that folder along with the osimPluginDLL.h, RegisterTypes_osimPlugin.cpp, RegisterTypes_osimPlugin.h, and CMakeLists.txt files copied from the BodyDragExample.
I was able to build the FatiguableMuscle successfully using Visual Studio Community 2017 (I am using OpenSim 4.1) and got the message: "Successfully loaded library C:\OpenSim 4.1\plugins\FatigableMuscle.dll" when I loaded it into OpenSim but when I load a model with the fatigable muscle I get the same error message Professor Audu got about it not being a registered object.
When I repeat this process for the Body Drag example I do see BodyDrag Class available in the Help->XML Browser dropdown but the fatigable muscle class is not there.
Reading through Ayman's post I am guessing my issue is with
1. Create a static instance of an object "instantiator" in a cpp file
When I was first tried to build the plugin I got an error in Visual Studio: "C:\OpenSim 4.1\Resources\Code\CPP\Plugins\MuscleFatigue\RegisterTypes_osimPlugin.cpp(33): error C2371: 'instantiator': redefinition; different basic types"
That line of code in RegisterTypes_osimPlugin.cpp is :
Code: Select all
static dllObjectInstantiator instantiator;
. I originally just commented this line out and then it built fine and loaded successfully in OpenSim (but couldn't use it). Now I am assuming that is NOT an acceptable workaround.
Do you have any suggestions for what may be going wrong?
Thanks!
Ty