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