I have a class with the public function in a dynamic library:
void setActiveAnimation(std::shared_ptr<MaJR::Animation> anim);
and when I attempt to call it like so:
MaJR::Actor actor;
actor.setActiveAnimation(idleAnimation);
I get the following:
/home/mike/NixCraft/main.cpp||In function 'int main()':|
/home/mike/NixCraft/main.cpp|12|error: no matching function for call to 'MaJR::Actor::setActiveAnimation(MaJR::Animation&)'|
/home/mike/NixCraft/main.cpp|12|note: candidate is:|
/usr/include/MaJR/Actor.hpp|16|note: void MaJR::Actor::setActiveAnimation(std::shared_ptr<MaJR::Animation>)|
/usr/include/MaJR/Actor.hpp|16|note: no known conversion for argument 1 from 'MaJR::Animation' to 'std::shared_ptr<MaJR::Animation>'|
||=== Build finished: 4 errors, 0 warnings ===|
What should I do?
The error clearly states that you are trying to call the function with a reference to
MaJR::Animationinstead of astd::shared_ptr<MaJR::Animation>. Whenever you declareidleAnimationyou should have instead:or better yet: