问题描述
我正在尝试使用 Qt Creator 使用 QTWebsockets 运行一个简单的客户端示例,已经添加了
I'm trying to run a simple client example using QTWebsockets using Qt Creator, already add the
QT += websockets
但是当我运行 build 或 qmake 时它会抛出这个
But it throws this when i run build or qmake
:-1: error: Unknown module(s) in QT: websockets
我试过了
QT += core websockets
然后意识到自从从存储库安装 Qt Creator 后它不是最新的,所以我从 Qt 网站重新安装了它但问题仍然存在,然后我运行 pkg-config --modversion QtCore 并返回 4.8.6,事情是,在 qt creator 的 QT 版本选项卡中,它向 GCC 编译器显示了 5.4.1,这是我正在使用的编译器,在/opt/Qt/5.4/gcc_64/lib 中,即使在帮助选项卡中也有 QT5WebSockets 模块列出了 QT5 模块,但我无法使用它们.
Then realized that since installed Qt Creator from the repositories it wasn't up to date, so I reinstalled it from the Qt website but the problem persisted, I then ran pkg-config --modversion QtCore and it returns 4.8.6, thing is, in the QT version tab of qt creator it shows 5.4.1 to GCC compiler which is the compiler I’m using, in /opt/Qt/5.4/gcc_64/lib there is the QT5WebSockets module even in the help tab are listed the QT5 modules but I can't use them.
用 SerialPort 尝试过,但没有用,用 Opengl 尝试过,它有效,这意味着是版本问题,但我似乎找不到如何解决.
Tried with SerialPort and it didn't work, tried with Opengl and it worked which means is a version problem but I can't seem to find how to solve.
推荐答案
sudo apt-get install libqt5websockets5-dev
这篇关于项目错误:QT 中的未知模块:websockets的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!