QT Development--"Beginning Linux Programming" 4th Edition

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.