Study Notes:
Dynamic library *. So
Static library *.
The standard header file is under/usr/include, which is automatically searched by default during system compilation.
In the command, you can add-I <LIBRARY PATH> to the specified header file to search for your own header file.
The default link library search path is/usr/lib and/lib.
-L specific database name to be linked
-L path to search for additional libraries
Example: G ++ hello. cpp-O hello-I/usr/lib/qt-3.1/include-lqt-L/usr/lib/qt-3.1/lib
Explanation:-lqt indicates link to the QT library, where the QT library name under/usr/lib/qt-3.1/lib is libqt. So
-L/usr/lib/qt-3.1/lib represents the path under/usr/lib/qt-3.1/lib
However, it is troublesome to write as above. You can use the following command to simplify
# Export ld_librar_path =/usr/lib/qt-3.1/lib
# Export cplus_include_path =/usr/lib/qt-3.1/include
After the environment variables are improved, run the following command:
# G ++ hello. cpp-O hello-lqt
Complete Compilation
But the above method is still troublesome. The best way is to create a file for each project.
Compile with the following commands:
# Qmake-Project
# Qmake
# Make
This completes the compilation.
Note that the header file and definition must be written in two files when the custom slot and signal are used: Write A. H file and. cpp file. This separation of writing is also advocated by code writing.
At qt4.3.5, the compilation method is the same as that of qt3.1. The biggest difference is the usage Syntax of some classes.
For example, if qt4.3.5 does not have setmainwidget (), and The plotting event in qt4.3.5 does not have to write a plotting function between paintbegin and paintend as in 3.1.
The greatest helper for learning QT is QT Assistant, which can be used to search for various types, member functions, etc. With it, you can achieve self-connection without division. The command is as follows:
# Assistant &
Let it run in the background. If we don't understand it, we can look for him. When we don't use it, it doesn't affect front-end work.