文章如果有显示异常,绝对是CSDN的锅…
居然不能显示“$$”,所以只能用“$$”代替(或者是我没找到方法,希望看到的朋友能给个提示)…
1. pro/pri中加入带空格的路径:$$quote
例:INCLUDEPATH += $$quote(C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include)
2.pro/pri文件中定义函数,分为两种,一种是不带返回值的,另一种是返回BOOL类型的。
例:
//The purpose is data processing, return result
defineTest(func1){
variable = $$1
!build_pass:message(test_func $$variable)
return (true)
}
//Returns a function of bool
defineReplace(func1){
message($$1 $$1) #get the first arg
message($$ARGS $$ARGS) #get all args
for(v, 1){
!build_pass:message($$v)
}
//Print the value of args
for(v, ARGS){
!build_pass:message($$v)
}
return ($$1)
}
//define two variables
NAME = lance
AGE = 24
func1($$NAME, $$AGE):!build_pass:message(success)
ABC = $$func1($$NAME, $$AGE)
!build_pass:message($$ABC)
输出:
Project MESSAGE: test_func lance
Project MESSAGE: succ

本文介绍了在Qt pro文件中添加带空格路径的方法,定义和使用无返回值及返回BOOL类型函数的示例,并展示了qmake内置变量的运用,如转换大小写、路径处理等。还讲解了QMAKE_PRE_LINK和QMAKE_POST_LINK在链接前后执行的操作。
&spm=1001.2101.3001.5002&articleId=71403543&d=1&t=3&u=6027857b5a6341f985e2ab0d04fb3668)
2683

被折叠的 条评论
为什么被折叠?



