Windows上QtBluetooth的替代品? [英] Alternatives to QtBluetooth on Windows?
问题描述
我有两台PC,它们没有通过电缆连接并且不在网络中,需要相互通信.我正在做两个Qt应用程序,想通过蓝牙进行通信.但是,我发现Qt不支持Windows的蓝牙( Qt是否支持Windows蓝牙API?). (产生qt.bluetooth: Dummy backend running. Qt Bluetooth module is non-functional.
)
I have two PCs, not connected with a cable and not in a network that need to communicate with each other. I'm doing two Qt apps and wanted to make the communication via Bluetooth. However, I found out that Qt does not support Bluetooth for Windows (Does Qt support the windows bluetooth API?). (It produces qt.bluetooth: Dummy backend running. Qt Bluetooth module is non-functional.
)
那么,我还必须通过蓝牙其他哪些方式来建立这种连接? 或者如何使QtBluetooth工作?我愿意接受新的建议.
So what other alternatives do I have to bluetooth to establish this connection? Or how can I make QtBluetooth work? I am open for new suggestions.
要传输的数据是QByteArray
.
我正在运行Windows 10 Pro和Qt 5.11.1.
I am running Windows 10 Pro and Qt 5.11.1.
根据 Qt是否支持Windows蓝牙API? ,QtBluetooth
确实可以在Windows上运行.我有两个Windows设备,它们具有完全相同的Windows和Qt版本.在其中一个上,蓝牙聊天示例可以完美地在另一个仍然没有,并且我收到错误消息Qt Bluetooth module is non-functional
.有人可以告诉我何时以及为什么出现此错误吗?
According to the new answer on Does Qt support the windows bluetooth API?, QtBluetooth
can indeed work on Windows. I have two windows devices with exactly the same windows and Qt version. On one of them the Bluetooth chat example works perfectly, on the other one it still doesn't and I get the error message that Qt Bluetooth module is non-functional
. Can someone tell me when and why this error appears?
我也看到了该线程,但是它对我没有帮助,因为它是特定于Linux的.
I have also seen this thread but it doesn't help me, because it's linux-specific.
推荐答案
This thread on the QtForum delivered the answer. It works when you switch to the MSVC compiler instead of the standard MinGW!
这是您的操作方式:
在安装Microsoft Visual Studio并在Qt中安装了MSVC软件包之后(请参见前面提到的线程),您需要通过转到工具">选项">工具包"来设置c ++的编译器.在此处选择MSVC编译器,然后在编译器:C ++:"中选择Microsoft Visual C ++编译器.
After installing Microsoft Visual Studio and having the MSVC package in Qt (see mentioned thread), you need to set the compiler for c++ by going to Tools>Options>Kits. There you choose the MSVC compiler and in "Compiler: C++:" you choose Microsoft Visual C++ Compiler.
我希望这对其他人有帮助.
I hope this helps someone else.
这篇关于Windows上QtBluetooth的替代品?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!