Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
By tbodine88 at 2012-03-28 12:11
I was writing a script to install the new version of passmark Burn In. I needed to check
whether whatever version of QT was installed would support it, and if not install
the appropriate libraries.
I have searched and searched for such a Qt version checker. But found little that is helpful.
So I downloaded Qt SDK 4.8.0 and cobbled this program together:
here is the main.cpp:
PHP Code:
#include <QtCore/QCoreApplication> /* A program to check the QT version against some desired version by Thomas Bodine */ int main(int argc, char *argv[]) { char * version, * minor, * subver; char * dot1, *dot2; version = strdup(qVersion()); minor = dot1 = strchr( version,'.'); minor++; dot2 = strchr( minor, '.'); subver = dot2; subver++; *dot1 = 0; *dot2 = 0; if ( argc < 4){ printf("usage:\n\t%s {major} {minor} {sub}\n%s%s%seg %s %s %s %s\n%s%s", argv[0], "\twhere \n", "\tmajor is the major version number\n", "\tminor is the minor version nuber\n" "\tsub is the subversion number\n", argv[0],version,minor,subver, "\nThis app will exit with error if the Qt version is not at least\n", "what is specified\n"); return 1; } if( strcmp( version, argv[1]) < 0 ) return 1; if (strcmp(version, argv[1]) > 0) return 0; if ( strcmp( minor, argv[2]) < 0) return 1; if ( strcmp(minor,argv[1]) > 0) return 0; if ( strcmp(subver,argv[3]) <0 ) return 1; return 0;//a.exec(); }/* end main*/
Here is the Makefile you'll need to change QTPATH for your installation
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.