- This topic has 4 replies, 3 voices, and was last updated 9 years, 6 months ago by .
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- You must be logged in to reply to this topic.
Home › Forum › SOFA › Programming with SOFA › [SOLVED] Develop a new FEM plugin
Hi,
I’m gonna to develop a new plugin by modify the build-in modulus in original frame-work.(eg.SparseGridTopology, HexahedronFEM,…)
I’ve create a new folder in sofa/application/plugin and put the files in it.
Because I’ve modify a little in theese files, I have renamed the files and the class name by putting “My” in front of the original names (eg. MySparseGridTopolopy) .
However, there is some compile error message like “warning C4273” or “error C2491” at where I’ve modified, and I can’t find out the problem.
My develop environment is VS2012 64bit in WIN7, hope anyone can help, thanks!
Hi,
I don’t know about Windows compilation errors, but you can have a look on the following documentation page and check your code: https://www.sofa-framework.org/documentation/general-documentation/dev-start-coding/
Hope this helps
Those errors are due to inconsistent DLL linkage. The most probable is that you did something wrong regarding the macros SOFA_BUILD_YOURPLUGIN and SOFA_YOURPLUGIN_API.
Check that:
– your CMakeFile defines a SOFA_BUILD_YOURPLUGIN macro
– your code uses that macro to determine the value of your SOFA_YOURPLUGIN_API macro
– your headers use that SOFA_YOURPLUGIN_API macro, and not the one from another plugin.
Clément Forest
Digital-Trainers
thanks, i wanna ask another question:
can i do public inheritance a class in the build-in macro?
for example:
class SOFA_MYGRID_API Mysparsegrid : public SparseGridTopology
which SparseGridTopology is in SOFA_BASE_TOPOLOGY_API.
Yes you can.
It does not need to be in the same project, but your CMakeLists.txt will need to use AddLinkerDependencies to link with that other project.
Do not forget to use the SOFA_CLASS macro in your class definition !
Regards,
Clément Forest
Digital-Trainers
WARNING
The forum has been moved to GitHub Discussions.
Old topics and replies are kept here as an archive.