Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there an easy way to print the GTK and QT versions installed on a system? I am wanting to make a script that will print the version numbers of various developer tools and libraries.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Ask pkg-config.

$ pkg-config --modversion gtk+-2.0
2.24.18
share|improve this answer
    
It would be good that it also handle if libraries aren't installed. –  Braiam Jul 6 '13 at 23:50
    
Using pkg-config on a non-existent .pc file results in a non-zero return code. –  Ignacio Vazquez-Abrams Jul 6 '13 at 23:51
    
I am writing the code like this (pkg-config --modversion gtk+-3.0 2>/dev/null || echo "GTK3 is not installed") –  Devyn Collier Johnson Jul 6 '13 at 23:52
    
@IgnacioVazquez-Abrams, thanks. This command is excellent. –  Devyn Collier Johnson Jul 6 '13 at 23:52
    
If you're only testing for presence and not the specific version then you don't need to pass --modversion. –  Ignacio Vazquez-Abrams Jul 6 '13 at 23:52
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.