How to install two versions of Qt and tell the application which to use?

这一生的挚爱 提交于 2019-12-10 15:03:02

问题


I am developing an application in Qt, but using D language (with QtD binding). I've noticed that my app crashes with Qt 4.7.x, so I need to use Qt 4.6.2 instead. However in my system Qt 4.7.2 is installed. Unfortunately I neither make QtD work with the latest Qt versions nor (I'm afraid) count on QtD developers...

The only thing I need to make my application install in system Qt 4.6.2 libs and use it, but let all the other applications still use Qt 4.7.2. Is it possible? If it is, how to do it then?


回答1:


The answer to your question is the version of Qt is determined by the qmake you use to generate your Makefile.

/opt/QtSDK/Qt-4.6.2/bin/qmake

/opt/QtSDK/Qt-4.7.3/bin/qmake

Each will use the library in the directory.




回答2:


It is possible to install several versions of the library into one system, and all package managers (rpm, deb) support this out of the box.

These libraries will be just differently named. For example, if id do

ls /usr/lib/ | grep libcurl

on my system, I'll get:

libcurl-gnutls.so.3
libcurl-gnutls.so.4
libcurl-gnutls.so.4.2.0
libcurl.so.3
libcurl.so.4
libcurl.so.4.2.0

, so, different version of the same library happily live together.

All you need to do is to link against the desired version of QT library. You need to sepcify it in linker options (don't remember the exact option).



来源:https://stackoverflow.com/questions/5962675/how-to-install-two-versions-of-qt-and-tell-the-application-which-to-use

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!