Installation Library Qt 4.8.5
-
I didn't understand a concept:
first of all: I have compiled and installed correctly library Qt 4.8.5 starting from their source code.
Then, I have witten a very simple Qt GUI Application and compiled it. All work correctly.
When I go into directory where has beed produced my output, I see the binary file more other files.When I try to run my binary file, my application work. BUT this mean that the library of Qt (shared library) are loaded in a specific space of my machine. I did't set any enviroment variable/create the link to the Qt shared library.
Someone is able to explain me?
Thanks for support.
Stefano -
Hello,
I think I have the answer : I guess you used qmake to generate your Makefile (not CMake). It sets in the linker options in the Makefile the path to the libraries corresponding to the version of Qt (for gcc this is the flags *-L* for static libraries and *-Wl,-rpath* for runtime libraries). Then when you (or more probably Qt) links a shared library it looks in this folder before searching the default library path. This can be seen in QtCreator's compile output, where I copied the following example :
@g++ -Wl,-rpath,/usr/local/Qt/qt-4.8.5/lib -o debug/target .obj_unix/main.o .obj_unix/myccpfile.o .obj_unix/moc_mycppfile.o .obj_unix/qrc_myproject.o -L/usr/local/Qt/qt-4.8.5/lib -lQtGui -L/usr/local/Qt/qt-4.8.5/lib -L/usr/X11R6/lib -lQtCore -lpthread@
This is under Linux but I think that it works in a similar way on Windows (MSVC) or MacOS (eventhough I don't have any clue as I don't use them) This feature is very interesting because it allows you to have more than one version of Qt installed and to use the one you want by just choosing the good @qmake@. As you can see in the example mine is not installed in the normal folder for lib (/usr/lib) but in a path I chose. Hope this helps you understand this miracle and that it is clear enough, please be clement, this is my first post as you can see. Regards,