- 动态库pro设置VERSION = 1.0.1901.0时,产生目标名字总会带数字1
解决方法:CONFIG += skip_target_version_ext
- 设置输出路径
-
DESTDIR = ./output
- 静态链接
-
LIBS += -L$$PWD/../../lib -lopencv_world320
编译前执行
-
QMAKE_PRE_LINK = cp - f [source] [destionation]
-
编译后执行
-
QMAKE_POST_LINK = cp - f [source] [destination]
Release版本也是可以调试的了
-
QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO QMAKE_LFLAGS_RELEASE = $$QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO
将所有的警告当成错误处理
-
QMAKE_CXXFLAGS += -Werror = return-type //函数有返回值 QMAKE_CXXFLAGS += -Werror = return-local-addr //返回局部变量地址 QMAKE_CXXFLAGS += -Werror = missing-field-initializers //缺少初始值设定项 QMAKE_CXXFLAGS += -Werror = maybe-uninitialized //变量可能没有被初始化 QMAKE_CXXFLAGS += -Werror = delete-non-virtual-dtor // QMAKE_CXXFLAGS += -Werror = unused-but-set-variable //设置了但未使用的变量 QMAKE_CXXFLAGS += -Werror = parentheses //括号不匹配 QMAKE_CXXFLAGS += -Werror = pointer-arith //指针用在了算术运算 QMAKE_CXXFLAGS += -Werror = reorder //警告构造函数的顺序不会被使用 QMAKE_CXXFLAGS += -Werror = format-extra-args //格式不对 QMAKE_CXXFLAGS += -Werror = format= //格式不对 QMAKE_CXXFLAGS += -Werror = unused-variable //未使用的变量
忽略该警告
-
QMAKE_CXXFLAGS += -Wno-unused-function //未使用的函数 QMAKE_CXXFLAGS += -Wno-unused-parameter //设置了但未使用的参数 QMAKE_CXXFLAGS += -Wno-comment //注释使用不规范。 QMAKE_CXXFLAGS += -Wno-sequence-point //如出现i=i++这类代码,则报警告