参考:
https://www.cnblogs.com/Braveliu/p/5107550.html
https://blog.csdn.net/adriano119/article/details/5878169
我的实例:
#-------------------------------------------------
#
# Project created by QtCreator 2019-01-11T16:11:27
#
#-------------------------------------------------
QT += core gui sql network serialport
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
#指定生成的应用程序名
TARGET = APP_Name
TEMPLATE = app
#指定目标文件(obj)的存放目录
OBJECTS_DIR += $$PWD/bin/build/objects
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
mainwindow.cpp
HEADERS += \
mainwindow.h
CONFIG += qt warn_on
CONFIG +=debug_and_release
debug
{
#debug的结果运行程序放这里
DESTDIR= $$PWD/bin/debug
MOC_DIR = $$PWD/bin/build/debug
}
release
{
#release的结果运行程序放这里
DESTDIR = $$PWD/bin/release
MOC_DIR = $$PWD/bin/build/release
}
另外,需要让build的过程数据,统一输出到一个位置,需要作如下设置:
参考:https://jingyan.baidu.com/article/6181c3e0b9d170152ef153af.html
完成后,退出QT Creator,然后在项目文件夹中删除“*.pro.user”配置文件,然后重新启动QT Creator。
再次编连项目的时候,就全部都在app/bin下面了。