Jump to content
  • Advertisement
Sign in to follow this  

[MSVC] Linking problem with DLL dependency

This topic is 3760 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, My game engine is subdivided into many c++ DLLs loaded at run time. Its been working well as an architecture. However now, I am getting some link problems. My main app links to a type defined and declared in a DLL. When I try to call a member function of that type, I get a link error, eg:
// main app
CBulletRigidObject g; //defined in Objects.dll
float h = g.getHeading();

error LNK2019: unresolved external symbol "public: float const & __thiscall CBulletRigidObject::GetHeading(void)" 

This is not great surprise since the cpp file for CBulletRigidObject is not in this project. I thought I could solve this by linking the main app to the Objects.lib generated when Objects.dll was built, but this has no effect! How come? And what is the correct way to overcome this? I don't want to add CBulletRigidObject.cpp to my main app, this defeats the object of using DLLs at all. Thanks! Si

Share this post

Link to post
Share on other sites
yeah I am,

Actually the BulletRigidObject is being accessed through its parent class, the DLL interface.

Here's a better example:

// ObjectManagerInterface.h

#include "BulletRigidObject.h"

struct IObjectManagerInterface
virtual boost::shared_ptr<CBulletRigidObject> GetObject( const unsigned int& oID ) = 0;

// Main.cpp

#include "ObjectManagerInterface.h"
boost::shared_ptr<CBulletRigidObject> obj = m_objectManager->GetObject(0);
obj->GetHeading(); // causes link error

Please help! :)

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!