Article From:


Lines starting with “#” and ending with uuuuuuuuuuuu

Template Variables

Tell qmake which makefile to generate



  • app – Represents that the project establishes a makefile for an application. This is the default value, so if the template is not specified, this will be used
  • lib – Makefile that represents the project’s creation of a library
  • subdir – Generate Makefile for subdirectories, which are specified by variable SUBDIRS.
  • vcapp – Generate software engineering for VS development environment (only for Windows system);
  • vclib – Generate library engineering for VS development environment (only for Windows system);

Generate Directory

Specify the directory of the generated executable, with absolute and relative paths

DESTDIR += ../bin

Generated Application Name

Software name

TARGET = qtest

CONFIG += console c++11 network CONFIG -= qt

You can use spaces to separate or “” to interlace.

Target File Directory

objA directory where files are stored, either absolutely or relatively

OBJECTS_DIR += ../tmp

Header files included in the project
Represents the header file in this project

    libcurl/curl/curl.h \
    libcurl/curl/curlbuild.h \
    libcurl/curl/curlrules.h \

Add automatically as long as add is in the qtcreator directory tree

Source File Included in Project

Represents the source files in this project

SOURCES += mytest.cpp\

Add automatically as long as add is in the qtcreator directory tree

The. UI Design Document Included in the Project

FORMS += forms/painter.ui

Resource File Included in Project

Represents the resource files contained in this project

RESOURCES += qrc/painter.qrc

As long as the adds in the qtcreator directory tree are added automatically, changing the pro file will update the directory tree in the qtcreator synchronously, but will not affect the resource files on the hard disk.

Additional Header File Contains Directory

Configure include directory when compiling and linking third-party libraries
for example

INCLUDEPATH += ./boost/include\
INCLUDEPATH += D:/boost/include\
  • You can use absolute or relative paths
  • In the relative path. / can be omitted
  • Blanks are not allowed in paths

For static libraries (.lib,.a) and dynamic libraries.

LIBS += -LD:/codetest/libcurlcpp/libcurl/lib/ -llibcurl\
        -LD:/codetest/libcurlcpp/libcurl/lib/ -lws2_32\
        -LD:/codetest/libcurlcpp/libcurl/lib/ -lwldap32\
        -LD:/codetest/libcurlcpp/libcurl/lib/ -lopencv\
        -LD:/codetest/libcurlcpp/libcurl/lib/ -lzmq


LIBS += D:/codetest/libcurlcpp/libcurl/lib/libcurl.lib\

Again or

LIBS += $$PWD/libcurl/lib/libcurl.lib\
  • The directory can be specified with – L and the name of the library can be specified with – L (no suffix,.Lib,.A,.So are applicable)
  • The complete path of the library can be specified directly by absolute path and relative path (suffix,.Lib,.A,.So are applicable), and the relative path is prefixed with $$pwd, and the path does not allow spaces.
  • LIBS += somepath This can be written in multiple lines or interlaced with “”
  • The last one applies only to windows static libraries
  • For Linux link libraries, such as libopencv.a or compiled by make for the opencv project, it is necessary to write-lopencv when linking.Write the name of the project instead of the file name of the library
  • For dynamic library dll, you must copy to the EXE execution directory or configure the path in the environment variable

Pre-compiled macro


Similar to setting precompiled options in vs in Engineering

win32 { SOURCES += 1.cpp } else { SOURCES += 2.cpp }

Conditional compilation based on platform

Variables applicable only to Windows compilation

DEF_FILE – The. def file that the application wants to connect to.
RC_FILE – Resource files for applications.
RES_FILE – The resource file to which the application is connected.

Source File Coding Mode


QT pro”

  • VAR = foobar =>When running qmake, assign values to variables
  • $$VAR =>When running qmake, the value of the QMake variable
  • $${VAR} =>The value of the QMake variable when running qmake (same but enclosed to separate from surrounding text)
  • $(VAR) =>Content of environment variables when running Makefile (not qmake)
  • $$(VAR) =>Content of environment variables when running qmake (not Makefile)

Post Views: 9

Leave a Reply

Your email address will not be published. Required fields are marked *