When you recently studied the Beginning Linux programming 4th edition, type the following example code
#include <qapplication.h> #include <qmainwindow.h> int main (int argc,char* args[]) { qapplication app ( Argc,args); Qmainwindow *window=new Qmainwindow (); App.setmainwidget (window); Window->show (); return app.exec ();}
According to $g + +-o Qwindow Qwindow.cpp-i$qtdir/include-l$qtdir/lib-lqui, the following error occurred:
/USR/BIN/LD:/tmp/ccizdzj7.o:undefined reference to symbol ' _zn7qwidget14setfocuspolicyens_11focuspolicye '/usr/bin/ Ld:note: ' _zn7qwidget14setfocuspolicyens_11focuspolicye ' is defined in dso/usr/lib64/qt-3.3/lib/libqt-mt.so.3 so try adding it to the linker command line/usr/lib64/qt-3.3/lib/libqt-mt.so.3:could not read Symbols:invalid operation Collec T2:error:ld returned 1 exit status
If you are prompted to direct/usr/lib64/qt-3.3/lib/libqt-mt.so.3 as input, you can compile successfully.
$ g++-o qwindow qwindow.cpp-i$qtdir/include-l$qtdir/lib-lqui $QTDIR/lib/libqt-mt.so.3
PS: in the process of reading this book, in the Chinese version of the fourth edition of p427:
The output part of the $./THREAD3A:
After fast input, you should output two sentences "you input 7 characters"
You input 7 characters
You input 7 characters
Instead of the three sentences in the book:
You input 7 characters
You input 7 characters
You input 7 characters
Learning Linux-related knowledge, I hope we all communicate together, progress together ....
QT Development--"Beginning Linux Programming" 4th Edition