#Static member linking issue w/ Visual Studio shared project

1 messages · Page 1 of 1 (latest)

stray berry
#

I'm not 100% sure if this is the right place to ask about my problem, since it may be related to visual studio and not my c++ code at all, but validation that my code is correct would be helpful nonetheless.

When I try to build I expect the PipeObstacle class to have access to Drawable's default constructor so it can add itself to the _objects unordered set that my Game class loops through to call all draw() functions and render the game. However, I get a linker error when the constructor for PipeObstacle attempts to reference Drawable() in it's initializer list. I have already tried using hpp only and inline static, and although I am using a two project setup with Drawable being held in a shared project, merging the projects together did not solve the issue.

Error:
unresolved external symbol "private: static class std::unordered_set<class std::shared_ptr<class ap::Drawable>,struct std::hash<class std::shared_ptr<class ap::Drawable> >,struct std::equal_to<class std::shared_ptr<class ap::Drawable> >,class std::allocator<class std::shared_ptr<class ap::Drawable> > > PipeObstacle::_objects" (?_objects@PipeObstacle@@0V?$unordered_set@V?$shared_ptr@VDrawable@ap@@@std@@U?$hash@V?$shared_ptr@VDrawable@ap@@@std@@@2@U?$equal_to@V?$shared_ptr@VDrawable@ap@@@std@@@2@V?$allocator@V?$shared_ptr@VDrawable@ap@@@std@@@2@@std@@A)

trail scrollBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

stray berry
#

!solved