在 Qt Creator 中使用 Windows SDK 7.1
我正在开发一个个人项目,需要 Microsoft SAPI5——文本转语音和语音识别。我已经构建了很多应用程序,但我决定切换并尝试学习 Qt 框架,因为它会让很多事情变得更加简单。
该项目将无法构建,因为它无法从 Windows SDK 找到头文件。我不明白我哪里错了。
我已尽力编辑我的 .pro 文件。除了下面的内容之外,我还尝试了一个明确列出头文件的版本,但仍然找不到该文件。
错误:sapi.h:没有这样的文件或目录
包含在peech.h中:
#include <QObject>
#include <sapi.h>
我的.pro文件:
QT += core gui
TARGET = QT_River
TEMPLATE = app
INCLUDEPATH += "C:\Projects\custom libraries\include" \
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Include";
win32:LIBS += "C:\Projects\custom libraries\lib_dbg" \
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib";
SOURCES += main.cpp \
window.cpp \
speech.cpp
HEADERS += window.h \
speech.h
FORMS +=
RESOURCES += \
systray.qrc
PS我想保持它跨平台兼容,但找不到Qt库来进行基于听写的语音识别和文本转换-演讲。如果有人知道,请告诉我。
PSS 我在互联网上寻找这个答案大约两个小时,包括彻底搜索这个网站。我发现没有任何帮助。
I have a personal project I'm working on that requires Microsoft SAPI5 -- text to speech and Speech Recognition. I have already built out a lot of the application, but I've decided to switch and try to learn the Qt Framework, as it will make a lot of things much simpler.
The project won't build as it can't find the header files from the Windows SDK. I can't figure out where I went wrong.
I've done my best to edit my .pro file. In addition to what's below, I also tried a version where I explicitly listed the header files, but it still couldn't find the file.
Error: sapi.h: No such file or directory
Includes in speech.h:
#include <QObject>
#include <sapi.h>
My .pro file:
QT += core gui
TARGET = QT_River
TEMPLATE = app
INCLUDEPATH += "C:\Projects\custom libraries\include" \
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Include";
win32:LIBS += "C:\Projects\custom libraries\lib_dbg" \
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib";
SOURCES += main.cpp \
window.cpp \
speech.cpp
HEADERS += window.h \
speech.h
FORMS +=
RESOURCES += \
systray.qrc
P.S. I'd like to keep it cross platform compatible, but can find no Qt libraries for doing dictation based Speech Recognition and text-to-speech. If anyone knows of one, please let me know.
P.S.S. I've been searching for this answer for about two hours on the internet, including a thorough search of this website. I found nothing that helped.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
今天早上几个小时后,我设法解决了我的问题。
我决定使用 Visual Studio 2010 + Qt 4.7.1,而不是使用 Qt Creator。我已经成功地实施了这个解决方案,并且我的项目已经启动并正在运行。
我向任何尝试使用 Windows SDK + Qt 的人推荐这种方法。
这是帮助我的资源(您需要的所有信息都在问题中):
编译 Qt - Visual Studio 2010
After many hours this morning, I've managed to resolve my problem.
Rather than using Qt Creator, I've decided to use Visual Studio 2010 + Qt 4.7.1. I've managed to implement this solution successfully, and have my project off the ground and running now.
I recommend this approach for anyone trying to use the Windows SDK + Qt.
This is the resource that helped me (all the information you need is in the question):
Compiling Qt - Visual Studio 2010
在 Qt Creator 中,您应该能够将任何版本的 Visual Studio 或 SDK 设置为工具链,并最终设置为 Qt“套件”。
如果您转到“工具”->“选项”->“构建和”运行后,您将看到“套件”和“编译器”选项卡(以及其他选项卡)。
在“编译器”选项卡上,您应该找到您的 SDK 版本编译器,也可以自己手动添加。
接下来,在 Kits 选项卡上,选择与您的编译器匹配的 Qt 版本,然后选择新创建/找到的编译器配置。
这应该使您可以从 Qt Creator 中进行构建。
如果没有,请告诉我哪里出了问题,以便我可以用您需要的信息改进这个答案。
In Qt Creator you should be able to set up any version of Visual Studio or the SDK as a toolchain and eventually a Qt "Kit".
If you go to Tools->Options->Build & Run, you are presented with the Kits and Compilers tabs (among others).
On the Compilers tab, you should either find your SDK version compiler, or you can manually add it yourself.
Next, on the Kits tab, pick the version of Qt that matches your compiler, and select your newly created/found compiler configuration.
This should make it possible for you to build from within Qt Creator.
If not, please tell me where it goes wrong, so I can improve this answer with the information you need.