Qt Creator 中的 XAudio2
我目前正在使用 XAudio2 开发一个音频项目,并且一直在使用 MSVC++ Express 2010。我编写了一些基本功能,并且我想尝试使用 Qt 制作 UI,所以我按照以下步骤进行操作我的 MSVC 版本中的 Qt:
- 下载 Qt 源代码
- 使用 cmd 提示符在 MSVC 中编译所有内容
- 创建一个使用 qmake & 的 Makefile 项目nmake
- 在我的项目中添加库、包含、dll 的目录
一切正常。
现在,我想反其道而行之,将我的项目导入到 Qt Creator 中,以便轻松使用 Qt 设计器,而且我只是想使用它,看看我是否喜欢它。
因此,我导入了一个使用 XAudio2 制作的简单控制台应用程序,并在 .pro 中添加了 XAudio 包含路径:
INCLUDEPATH += "C:/Program Files/Microsoft DirectX SDK (June 2010)/Include"
我在编译时遇到的问题是:
main.obj:-1: error : LNK2019: unresolved external symbol __imp__CoInitializeEx@8 referenced in function _main
File not found: main.obj
文件就在那里,编译创建了它:
C:\Qt\qtcreator-2.2.1\projects\test-build-desktop\debug
我不知道为什么 Creator 找不到它...有什么想法吗?这是我需要包含的库,当我在 MSVC 工作时会自动包含它吗?
I'm currently working on an audio project with XAudio2 and I've been using MSVC++ Express 2010. I wrote some basic functionalities, and I thought I'd try making a UI with Qt, so I followed the steps to be able to use Qt in my version of MSVC:
- Download the Qt source code
- Compile everything in MSVC with the cmd prompt
- Create a Makefile project that uses qmake & nmake
- Add the directories for the libs, includes, dlls in my project
And everything works fine.
Now, I would love to go the other way around and import my project into Qt Creator to use the Qt designer easily, and also because I would simply like to play with it and see if I like it.
So, I imported a simple console application I made using XAudio2, and I added the XAudio include path in the .pro:
INCLUDEPATH += "C:/Program Files/Microsoft DirectX SDK (June 2010)/Include"
The problem I get at compilation is:
main.obj:-1: error : LNK2019: unresolved external symbol __imp__CoInitializeEx@8 referenced in function _main
File not found: main.obj
The file is right there though, the compilation creates it:
C:\Qt\qtcreator-2.2.1\projects\test-build-desktop\debug
and I have no idea why Creator can't find it... Any ideas? Is it a libraby I need to include that would be automatically included when I worked in MSVC?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我找到了答案,但这很难。 8小时后,就到这里了。 CoInitializeEx 初始化供调用线程使用的 COM 库以及其他一些内容...
CoInitializeEx 函数参考
以下链接解释了如何在 Qt 中使用 COM 对象。
在 Qt 中使用 COM 对象
基本上,您将添加
到
中。 pro
文件另外,由于某种原因,即使它与此无关,我也必须使用 jom,因为 nmake 不起作用。
Well, I found my answer, but it was a hard one. So, 8 hours later, here it is. CoInitializeEx initializes a COM library for use by the calling thread, and some other stuff...
CoInitializeEx Function Reference
The following link explains how to use COM objects with Qt.
Using COM objects in Qt
Basically, you add
to your
.pro
fileAlso, for some reason, even though it has nothing to do with this, I had to use jom because nmake wouldn't work.