The Qt project loads the library file, which is usually added to the project file with the pro suffix.
Method 1 (regular case)
- On the Unix system
-L
is the link library directory, and-l
is the name of the loaded library; - In the windows system, you can directly add the library;
- The unix system test library is:
/usr/local/lib/libtest.so
; - The windows system test library is:
C:/mylibs/test.lib
.
unix:LIBS += -L/usr/local/lib -ltestwin32:LIBS += C:/mylibs/test.lib
Method 2 (special case)
- Add if there is a space in the library path;
- Under the Unix system, double quotes ("") are required to include the path of the library;
- Under the windows system, the path name of the library needs to be included.
unix:LIBS += "-L/home/user/test libs" -ltest win32:LIBS += "C:/mylibs/test libs/test.lib"
Summarize
- The above two methods can be used interchangeably regardless of the loading method of the unix and windows libraries.