December 12, 2011

Ashish Mittal Ashish Mittal
Lab Rat
165 posts

error while loading QtNetwork4.dll

 

Hi,

I have created one C++ dll project using QTCreator, this project depends on QtNetwork4.dll since it uses QTcpSocket inside it. when I put QtNetwork4.dll in the same project output folder and when trying to load my dll using LoadLibrary() call, it is giving error as “This application has failed to start because QtNetwork4.dll was not found. Reinstalling the application may fix this problem”. When I try to open my dll in dependstool it is reflecting my exported functions from dll.

Regards
Ashish

6 replies

December 12, 2011

sierdzio sierdzio
Area 51 Engineer
4825 posts

Why do you use LoadLibrary()? On Windows, AFAIK, you can just place the .dll in the project folder and OS will load them automatically.

 Signature 

(Z(:^

December 12, 2011

Volker Volker
Ant Farmer
5428 posts

@sierdzio
As I understood it, the LoadLibrary call is for loading Ashish’s own DLL which in turn depends on QtNetwork4.dll.

@Ashish
QtNetwork4.dll must be stored to the directory where your executable .exe is, not into the folder where your own DLL is.

As a side note: Did you consider using QLibrary to load your DLL in a platform independent manner?

December 12, 2011

sierdzio sierdzio
Area 51 Engineer
4825 posts

Yes, I think you are right. I am not too familiar with Windows, but the “custom” dll should manage to load QtNetwork itself, yes?

 Signature 

(Z(:^

December 13, 2011

Volker Volker
Ant Farmer
5428 posts

The custom DLL usually doesn’t load anything, it’s the main executable/the kernel that is responsible for that. DLLs are searched in a search path, usually the system directories like C:\Windows\… and the directory hosting the .exe.

December 13, 2011

sierdzio sierdzio
Area 51 Engineer
4825 posts

I’ve never encountered that, myself. But, I’ve got everything in path PATH, so maybe it just worked. Anyway, thanks for info, I think I’ll experiment with that topic a bit.

 Signature 

(Z(:^

December 13, 2011

Ashish Mittal Ashish Mittal
Lab Rat
165 posts

Yes you are right, because of PATH environmental variable would have been set in your system , so that it has taken the reference from there, for me it was not set. I tried to put the QtNetwork4.dll in C:\Windows\System32 folder and then it Workz!!!

Thanks a lot for suggestions.

 
  ‹‹ QScrollBar and handle height      Editable QComboBox with empty edit text: Avoid automatic text change when model is modified ››

You must log in to post a reply. Not a member yet? Register here!