The reason why qmake cannot make the project in Ubuntu

Source: Internet
Author: User
Install QT In ubuntu (for the time being, I will write the same problem I encountered later. Thank you for this author)

Http://www.cnblogs.com/hanleisheshou/archive/2010/03/11/1683078.html

After the Ubuntu system is successfully installed, install the QT compiling environment as follows:
Sudo apt-Get install qt4-dev-tools qt4-demos qt4-designer qt4-doc
Sudo apt-Get install qdevelop
After a period of waiting, the QT compiling environment was successfully installed. I quickly wrote a hello Word program to try it out, as shown below:
# Include <qapplication>
# Include <qlabel>
Int main (INT agrc, char * argv [])
{
Qapplication app (argc, argv );
Qlabel * label = new qlabel ("Hello word ");
Label-> show ();
Return app.exe C ();
}
The compilation command is as follows:
Qtmake-Project
Qtmake
Make
The compilation result prompts that the related qapplication qlabel and other classes cannot be found. It seems that QT seems to have installed less, but in fact it has already been installed.
Strange?
Solution:
The Ubuntu operating system now integrates the integrated development environment of QT, but the version is qt3. Although I have installed qt4, the Environment Variable
No update is automatically performed. When the qtmake command is used, the qt3 compilation library is called by default, and qapplication qlabel cannot be found in qt3.
Class, so an error is reported,
Run the following command to view the current environment variable:
Ls/usr/bin/qmake-lH running result: lrwxrwxrwx 1 Root 23/usr/bin/qmake->/etc/alternatives/qmake
Ls/etc/alternatives/qmake-lH running result: lrwxrwxrwx 1 Root 18 2010-03-10/etc/alternatives/qmake->/usr/bin/qmake-qt3
The following changes should be made:
Rm/etc/alternatives/qmake

Ln-s/usr/bin/qmake-qt4/etc/alternatives/qmake

Or use the following command to compile

Qmake-qt4-project

Qmake-qt4

Make

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.