Qt系列文章目录
前言
warning: F:/QtExercise/QWidgetQml/main.cpp conflicts with F:/QtExercise/QWidgetQml/src/main.cpp
warning: Automatically turning off nmake’s inference rules. (CONFIG += no_batch)
warning: F:/QtExercise/QWidgetQml/main.cpp conflicts with F:/QtExercise/QWidgetQml/src/main.cpp
warning: Automatically turning off nmake’s inference rules. (CONFIG += no_batch)
一、警告原因
工程中有2个同名的文件,比方说2个main.cpp
二、无法直接在QtCreator新建过滤器
我们使用visual studio时候,经常在项目中新建过滤器,而在QtCreator中无法新建过滤器。
新建中没有创建“新建筛选器”的选项
在QtCreator中创建解决方案
- 首先在QtCreator创建一个空项目
2.手动创建pro文件,里面包含工程,我这里分别包含了3个工程:
(1)PublishBlogManager
(2)SubscribEventHandle
(3)Test
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS += \
PublishBlogManager \
SubscribEventHandle \
Test
3.分别为
(1)PublishBlogManager
(2)SubscribEventHandle
(3)Test
这3个工程创建pro文件
PublishBlogManager .pro
QT += core
QT -= gui
TEMPLATE = lib
CONFIG += plugin
TARGET = PublishBlogManager
DESTDIR=../output/bin/plugins
//头文件路径
INCLUDEPATH += $$PWD/../include/Core \
+= $$PWD/../include/PluginFramework \
+= $$PWD/../include/Widgets
//源码安装路径
INCLUDEPATH += $$PWD/../ctkInstall/Libs/PluginFramework \
+= $$PWD/../ctkInstall/Libs/Core \
+= $$PWD/../ctkInstall/Libs/Widgets
//静态库路径
LIBS += -L$$PWD/../libs -lCTKCore -lCTKPluginFramework -lCTKWidgets
HEADERS += \
BlogManager.h \
BlogManagerActivator.h
SOURCES += \
BlogManager.cpp \
BlogManagerActivator.cpp
RESOURCES += \
Resource.qrc
SubscribEventHandle .pro
QT += core
QT -= gui
TEMPLATE = lib
CONFIG += plugin
TARGET = SubscribEventHandle
DESTDIR=../output/bin/plugins
//头文件路径
INCLUDEPATH += $$PWD/../include/Core \
+= $$PWD/../include/PluginFramework \
+= $$PWD/../include/Widgets
//源码安装路径
INCLUDEPATH += $$PWD/../ctkInstall/Libs/PluginFramework \
+= $$PWD/../ctkInstall/Libs/Core \
+= $$PWD/../ctkInstall/Libs/Widgets
//静态库路径
LIBS += -L$$PWD/../libs -lCTKCore -lCTKPluginFramework -lCTKWidgets
HEADERS += \
BlogEventHandler.h \
BlogEventHandlerActivator.h
SOURCES += \
BlogEventHandler.cpp \
BlogEventHandlerActivator.cpp
RESOURCES += \
Resource.qrc
Test.pro
#-------------------------------------------------
#
# Project created by QtCreator 2020-07-29T16:35:18
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Test
TEMPLATE = app
DESTDIR=../output/bin/plugins
# 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
CONFIG += c++11
//头文件路径
INCLUDEPATH += $$PWD/../include/Core \
+= $$PWD/../include/PluginFramework \
+= $$PWD/../include/Widgets
//源码安装路径
INCLUDEPATH += $$PWD/../ctkInstall/Libs/PluginFramework \
+= $$PWD/../ctkInstall/Libs/Core \
+= $$PWD/../ctkInstall/Libs/Widgets
//静态库路径
LIBS += -L$$PWD/../libs -lCTKCore -lCTKPluginFramework -lCTKWidgets
SOURCES += \
main.cpp \
MainWindow.cpp
HEADERS += \
MainWindow.h
FORMS += \
MainWindow.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
加入qml文件
加入qml文件会自动生成qml筛选器