Qt Creator:如何区分 win32 和 win64 [英] Qt Creator: how to tell win32 from win64

查看:71
本文介绍了Qt Creator:如何区分 win32 和 win64的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在 .pro 文件中做这样的事情:

I have to do something like this in a .pro file:

win32 {
    LIBS += -L../3rdparty/libusb-win32/lib/msvc -llibusb
} else
win64 {
    LIBS += -L../3rdparty/libusb-win32/lib/msvc_x64 -llibusb
}

问题是它不起作用,它总是链接 win32 库.有什么建议吗?

The problem is it doesn't work, it always links win32 library. Any suggestions?

推荐答案

您可以使用 QT_ARCH 变量来检测您的配置是 32 位还是 64 位:

You can use QT_ARCH variable to detect whether your configuration is 32 or 64 :

contains(QT_ARCH, i386) {
    message("32-bit")
}else {
    message("64-bit")
}

当目标是 32 位时,变量返回 i386,如果是 64 位目标,它的值为 x86_64.

When the target is 32-bit, the variable returns i386 and in case of a 64-bit target it has the value of x86_64.

这篇关于Qt Creator:如何区分 win32 和 win64的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆