Qt Creator locating dynamic libraries
On Windows, Qt Creator seems to have some way of automatically locating dynamic libraries, so that they are found when a built application is run. Because in some situations it manages to run applications I build without any need for me to move or include DLLs in the path. However, for some weird reason it does not work if I use e.g. the full win32-msvc2008 mkspec to add the library path:
- win32-msvc2008:LIBS += /my/lib/path
But it works if I do:
- win32:LIBS += /my/lib/path
- LIBS += /my/lib/path
Has anyone else seen this, and can anyone think of what is going on and why?
(On Linux, I have to add the paths to the LD_LIBRARY_PATH manually in the run environment.)
u can use like this for windows.
LIBS += C:\QtSDK\mingw\lib\libws2_32.a
Not sure I understand your answer, and not really sure you understood my question either… :)
My question does not have anyhting to do with deployment.
It has to do with running my application from Qt Creator, pressing the Run button or Ctrl-R.
And I know how to make qmake find libraries at compile time.
What I don’t understand is how Qt Creator finds the corresponding DLLs at run time.
Did you solved it?
I have the same problem, i add a .so file to my application
Then it compiled and link is ok
But when i pressing the Run button or Ctrl-R， there some error：
“To help dpkg-shlibdeps find private libraries, you might need to set LD_LIBRARY_PATH.
dh_shlibdeps: command returned error code 512”
how do i set the LD_LIBRARY_PATH
You can set LD_LIBRARY_PATH in the run environment in Qt Creator. The run environment is accessible on the Projects page, under Run Settings. Just press the Details button under Run Environment, and then the Add button. (This is for Qt Creator 2.4.1, it might look slightly different in another version.)
I’m not developing on Linux at the moment, so I don’t have this problem any more, and don’t know if it has been fixed in a recent Qt Creator release. But if you have the same problem, I guess it hasn’t. But setting LD_LIBRARY_PATH as I describe should solve it for you.
Ludde: Creator evaluates the LIBS variable from qmake and sets up the environment in such a way that those libs are found. That the first case does not work is a bug. Did you file a report [bugreports.qt-project.org] for it?