When I make static libraries of Qt (libQtCore.a and libQtGui.a) using following steps
1) cd to path for qt-x11-commercial-src-4.3.3
2) setenv PATH /pathto-qt-x11-commercial-src-4.3.3/bin:$PATH
3) gmake confclean
4) ./configure -release -static -largefile -qt3support -qt-libpng -qt-libmng -qt-libtiff -qt-libjpeg -glib -platform linux-g++-64 -confirm-license -no-openssl -no-qdbus -prefix ./static_new -prefix-install -opengl -sm -L/usr/lib64 -lSM -lICE -xshape -lX11 -xinerama -lXinerama -xcursor -lXcursor -xfixes -lXfixes -xrandr -lXrandr -xrender -lXrender -fontconfig -lfontconfig -tablet -lXi -xkb -glib -lglib-2.0 -lXext
5) gmake
6 gmake install
then I have to explicitly put following lines in my makefile to link X libraries in my final executable
SLIBS += SM ICE Xi Xrender Xfixes Xrandr Xcursor Xinerama freetype Xext z gthread-2.0 glib-2.0 QtGui QtCore fontconfig
otherwise I get undefined reference for symbols in above X libraries.
But when I make shared libraries of libQtGui.so and libQtCore.so using following steps
1) cd to path for qt-x11-commercial-src-4.3.3
2) setenv PATH /pathto-qt-x11-commercial-src-4.3.3/bin:$PATH
3) gmake confclean
4) configure -release -shared -largefile -qt3support -qt-libpng -qt-libmng\
-qt-libtiff -qt-libjpeg -glib -platform linux-g++-64 -confirm-license -no-openssl -no-qdbus -prefix ./static_new -prefix-install -opengl -sm -L/usr/lib64 -lSM -lICE -xshape -lX11 -xinerama -lXinerama \
-xcursor -lXcursor -xfixes -lXfixes -xrandr -lXrandr -xrender -lXrender \
-fontconfig -lfontconfig -tablet -lXi -xkb -glib -lglib-2.0 -lXext -lz \
-lgthread-2.0
5 gmake
6 gmake install
then I only have to put following lines in my makefile
SLIBS += QtGui QtCore
I do not have to put code in my makefile to link X libraries in the final executable
My question in why do have explicitly link X libraries while integrating static libraries libQtGui.a and libQtCore.a in my final executable