[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: building a qt library

From: Lorenzo Bettini
Subject: Re: building a qt library
Date: Sun, 30 Nov 2008 14:24:30 +0100
User-agent: Thunderbird (X11/20081125)

Craig Sanders wrote:
Lorenzo Bettini <address@hidden> wrote:>
Craig Sanders wrote:
Greetings Lorenzo.

I have used the GNU Autotools in the past to build some simple
projects which made use of the Qt Library. I prefer to use the GNU
Autotools as I find them much more flexible and much more powerful than

As I recall, there are 2 key steps that need to be performed when
using the GNU Autotools with Qt.

Step 1, You will need to get hold of an Autoconf macro which will
detect if and if so, where you have a Qt Library installed on your
system. If this macro detects that you have a Qt Library installed on
your system, then it will generate some appropriate settings for you.

Step 2, You will also need to instruct the Autotools how to invoke
the Qt moc (Meta Object Compiler) on your relevant source code files.

To accomplish the first step, you should be able to find an
appropriate Autoconf macro here ;

Personally, I use the macro bnv_have_qt - information about which can
be found here ;

I then call this macro from my file as is illustrated

Hi Craig

thanks a lot for your answer!

I've just tried this macro on a brand new empty project...  I'm testing
it under windows with cygwin, and it seems to fail: I run configure like

./configure --with-Qt-lib-dir=/usr/lib/qt3/lib/
--with-Qt-bin-dir=/usr/lib/qt3/bin/ --with-Qt-lib=qt

and I get

checking for Qt... yes:
     QT_LIBS=-L/usr/lib/qt3/lib/ -lqt  -lSM -lICE  -lX11 -lXext -lXmu
-lXt -lXi
checking correct functioning of Qt installation... failure
configure: error: Failed to find matching components of a complete
                   Qt installation. Try using more options,
                   see ./configure --help.

Actually, the link phase of the test example fails...  have you even
tried your project under cygwin?


Hello again Lorenzo.

Hi Craig

I haven't tried configuring and building my Qt project using Cygwin under 
Windows. Rather, I have only configured and built it under Linux Fedora Core 2 
and using the default Qt installation (version 3.3) that is distributed with it.

If I invoke the following switch ;


I used this switch too, actually I used the more complete form (otherwise headers and libraries would not be found at all)

when I run the configure script, then my project successfully configures and 
compiles. This has always worked for me, so I haven't bothered to try using any 
of the other Qt related configure script switches, i.e. --with-Qt-lib-dir, etc.

You could maybe try using this approach, and if you find that it doesn't work 
for you then you could perhaps send an e-mail to the author of the bnv_have_qt 
macro. I don't use Windows for software development, so I'm not sure what you 
would need to do in order to get the bnv_have_qt macro to find your Qt 
installation using just this one configure script switch. Sorry I can't be of 
more any more help.

as I said, libraries and headers (and also tools) are correctly found, but it does not seem to succeed in the linking phase (of the configure test)... with a qmake project and makefile instead it seems to work...

I've already emailed to the author as well :-)

I don't develop under windows either (using Linux instead), but I always port my programs in windows using cygwin, that's why I was concerned...

Under linux that macro works perfectly...

I was also thinking of using the pkg-config approach, since qt ships the .pc files

Good luck with it.

hope to have some good news soon :-)


Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134     (GNU/Linux User # 158233)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]