Results 1 to 6 of 6

Thread: Library (.dll) found but not loading when running outside Qt Creator

  1. #1
    ucomesdag Guest

    Question Library (.dll) found but not loading when running outside Qt Creator

    Hi,

    I'm using the latest SDK with Qt 4.6.2. I got all (5 in total) but one library (.dll) loading. When running from Qt Creator it loads fine but when running outside it doesn't get loaded.

    QLibrary::errorString() gives me: "Cannot load library ./weblord.dll . The specified module could not be found."
    and QFile::exists() finds the library ./weblord.dll. All loaded libraries have the same path (./libname.dll)

    On Linux it loads all libraries fine. All libraries are in the root with the executable.

    Has someone an idear what might be going on.

    In Qt 4.5.3 it was all running fine, I cleaned out the project and reran qmake and it compiles without any warning or errors.

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Library (.dll) found but not loading when running outside Qt Creator

    On windows, remove the "./" to have the OS search the current directory first. Or you could change your path environment variable.

  3. #3
    ucomesdag Guest

    Default Re: Library (.dll) found but not loading when running outside Qt Creator

    Quote Originally Posted by fatjuicymole View Post
    On windows, remove the "./" to have the OS search the current directory first. Or you could change your path environment variable.
    Changing the path doens't make the library load but doesn't affect the other libraries either, they still load.
    Why should I change any environment variables?
    I suplied the path of the library, and it works fine for all 4 other libraries in the same directory.

    I tried something else I renamed another library to weblord.dll and it loads fine. So maybe the library is corrupted. strange I don't get any errors or warnings when compilling. Also strange it runs fine from Qt Creator and not outside....

  4. #4
    ucomesdag Guest

    Default Re: Library (.dll) found but not loading when running outside Qt Creator

    How can I check if my dll is valid? At runtime it is found, but not loading with a vague message "Cannot load library" and "The specified module could not be found". While before and after the call QFile finds the file????
    My deduction is that something is wrong with the library. I didn't change any code. I just upgraded to QT 4.6.2 (SDK) (and yes I completely cleaned out the project and compiled it from scratch).

  5. #5
    ucomesdag Guest

    Default Re: Library (.dll) found but not loading when running outside Qt Creator

    Problem solved with Qt Beta 4.7

  6. #6
    Join Date
    Jun 2010
    Location
    Pretoria, South Africa
    Posts
    22
    Thanked 7 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Library (.dll) found but not loading when running outside Qt Creator

    I had a similar problem where a DLL was loading when I was running the application in VS and giving me an error when running from the command prompt.

    I found that the problem was not that Windows couldn't find the DLL itself to load but rather one of its dependencies. Use the Dependency Walker to find which file should be copied to your application directory.

    I'm assuming the reason that the application was running in VS was because the dependent DLL (in my case QtSql.dll) was being referenced in a library path by VS that was not in my console's path.

Similar Threads

  1. Qt Creator - problem loading project
    By Ferric in forum Newbie
    Replies: 1
    Last Post: 7th January 2010, 22:25
  2. Running app from within Creator
    By rbp in forum Qt Tools
    Replies: 2
    Last Post: 2nd October 2009, 00:51
  3. Replies: 4
    Last Post: 20th May 2009, 10:20
  4. Problem loading custom library in Qt4.5
    By ches in forum Newbie
    Replies: 2
    Last Post: 10th March 2009, 19:46
  5. Loading library from application
    By mourad in forum Installation and Deployment
    Replies: 0
    Last Post: 2nd April 2008, 15:10

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.