Jasko
Jasko

Reputation: 119

Qt DLL not loading (when using Qwt inside)

I am trying to use Qwt in one of my Qt DLLs.

The thing is that the library does not load if I call a constructor of QwtPlot inside. If I comment it out it loads. Just to note that DLL builds successfully when QwtPlot is uncommented.

I am using Visual Studio 2010.

Any thoughts?

EDIT (code that loads the dll, though the code works just fine for the dll which does not have QWT inside):

typedef bool (*EntryPointPtr)(); 
HINSTANCE _pDLL; 
EntryPointPtr _pFn; 
_pDLL = ::LoadLibrary("..\\MyDll.dll"); 
_pFn = (EntryPointPtr) ::GetProcAddress(_pDLL, "qtLoader");
_pFn();

Upvotes: 0

Views: 1661

Answers (1)

Jasko
Jasko

Reputation: 119

Problem solved and here is the solution for anyone who might encounter the same problem again.

Initially I set up the project settings as follows:

  1. VC++ Directories -> Include Directories -> path to QWT src folder
  2. VC++ Directories -> Library Directories -> path to QWT lib folder
  3. Linker -> Input -> Additional dependencies -> qwtd.lib or qwt.lib (according to debug mode)

What needed to be done is:

  1. C/C++ -> General -> Additional include directories -> path to QWT src folder
  2. Linker -> General -> Additional library directories -> path to QWT lib folder
  3. Linker -> Input -> Additional dependencies -> qwtd.lib or qwt.lib (according to debug mode)

Seems like Visual Studio could not link it properly using the initial option.

PS. Thanks for helping. Your answers guided me in the right direction and eventually helped me to figure out what the problem was. Respect to you all.

Upvotes: 3

Related Questions