ksmedia.h 中的编译错误(在直接 X sdk 中)
我得到了一个 C++ 项目,我必须在另一台计算机上编译和运行该项目。它使用 Direct X SDK。我没有修改该项目的任何内容。但是,当我尝试在 Visual Studio 2008 中编译该项目时,我在 ksmedia.h 中收到许多编译错误。我进行了搜索,但找不到任何其他人与我遇到的相同错误以及有效的解决方案。它们如下:
1>path\Include\ksmedia.h(453) : error C2332: 'struct' : missing tag name
1>path\Include\ksmedia.h(453) : error C2011: '<unnamed-tag>' : 'enum' type redefinition
1> path\BaseClasses\wxdebug.h(58) : see declaration of '<unnamed-tag>'
1>path\Include\ksmedia.h(453) : error C2143: syntax error : missing ';' before '__uuidof'
1>path\Include\ksmedia.h(453) : error C2059: syntax error : '__uuidof'
1>path\Include\ksmedia.h(547) : error C2332: 'struct' : missing tag name
1>path\Include\ksmedia.h(547) : error C2011: '<unnamed-tag>' : 'enum' type redefinition
1> path\BaseClasses\wxdebug.h(58) : see declaration of '<unnamed-tag>'
1>\Include\ksmedia.h(547) : error C3121: cannot change GUID for class '<unnamed-tag>'
1> path\BaseClasses\wxdebug.h(58) : see declaration of '<unnamed-tag>'
1>path\Include\ksmedia.h(547) : error C2143: syntax error : missing ';' before '__uuidof'
1>path\Include\ksmedia.h(547) : error C2059: syntax error : '__uuidof'
1>path\Include\ksmedia.h(553) : error C2332: 'struct' : missing tag name
1>path\Include\ksmedia.h(553) : error C2011: '<unnamed-tag>' : 'enum' type redefinition
1> path\BaseClasses\wxdebug.h(58) : see declaration of '<unnamed-tag>'
1>path\Include\ksmedia.h(553) : error C3121: cannot change GUID for class '<unnamed-tag>'
1> path\BaseClasses\wxdebug.h(58) : see declaration of '<unnamed-tag>'
1>path\Include\ksmedia.h(553) : error C2143: syntax error : missing ';' before '__uuidof'
1>path\Include\ksmedia.h(553) : error C2059: syntax error : '__uuidof'
任何有关导致这些错误的原因或我可以采取哪些措施来修复这些错误的知识将不胜感激。
编辑:我使用的是旧版本的 ksmedia.h 文件。我已将副本更改为 ksmedia.h 并更新了错误消息以反映更改。此外,Windows 和 DirectX SDK 版本相同。但是,它编译的计算机是 32 位,而不会编译的计算机是 64 位。
I was given a C++ project that I have to work on that compiles and works on a different computer. It uses the Direct X SDK. I have not modified anything about the project. However, when I try to compile the project in Visual Studio 2008, I get a number of compile errors in ksmedia.h. I searched and couldn't find any others with the same errors that I am getting and a valid solution. They are as follows:
1>path\Include\ksmedia.h(453) : error C2332: 'struct' : missing tag name
1>path\Include\ksmedia.h(453) : error C2011: '<unnamed-tag>' : 'enum' type redefinition
1> path\BaseClasses\wxdebug.h(58) : see declaration of '<unnamed-tag>'
1>path\Include\ksmedia.h(453) : error C2143: syntax error : missing ';' before '__uuidof'
1>path\Include\ksmedia.h(453) : error C2059: syntax error : '__uuidof'
1>path\Include\ksmedia.h(547) : error C2332: 'struct' : missing tag name
1>path\Include\ksmedia.h(547) : error C2011: '<unnamed-tag>' : 'enum' type redefinition
1> path\BaseClasses\wxdebug.h(58) : see declaration of '<unnamed-tag>'
1>\Include\ksmedia.h(547) : error C3121: cannot change GUID for class '<unnamed-tag>'
1> path\BaseClasses\wxdebug.h(58) : see declaration of '<unnamed-tag>'
1>path\Include\ksmedia.h(547) : error C2143: syntax error : missing ';' before '__uuidof'
1>path\Include\ksmedia.h(547) : error C2059: syntax error : '__uuidof'
1>path\Include\ksmedia.h(553) : error C2332: 'struct' : missing tag name
1>path\Include\ksmedia.h(553) : error C2011: '<unnamed-tag>' : 'enum' type redefinition
1> path\BaseClasses\wxdebug.h(58) : see declaration of '<unnamed-tag>'
1>path\Include\ksmedia.h(553) : error C3121: cannot change GUID for class '<unnamed-tag>'
1> path\BaseClasses\wxdebug.h(58) : see declaration of '<unnamed-tag>'
1>path\Include\ksmedia.h(553) : error C2143: syntax error : missing ';' before '__uuidof'
1>path\Include\ksmedia.h(553) : error C2059: syntax error : '__uuidof'
Any knowledge on what is causing these errors or what I can do to fix them would be greatly appreciated.
EDIT: I was using an old version of the ksmedia.h file. I have changed my copy to ksmedia.h and updated the error message to reflect the change. Also, the Windows and DirectX SDK versions are the same. However, the computer it compiles on is 32-bit and the one it won't is 64-bit.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于该项目在一台计算机上编译,但不能在另一台计算机上编译,因此您显然正在寻找两者之间的一些差异。
一种可能性是两个系统安装了不同版本的 DirectX SDK。也许可能性不大,但值得检查一下是否只是为了将其排除在考虑范围之外。
另一种可能性是两个系统安装了不同版本的其他 SDK。
第三种可能性是 Visual Studio 的两个副本配置为以不同的顺序搜索各种 SDK 的包含文件夹。当某种类型或宏的定义来自一个系统上的一个头文件和另一个系统上完全不同的头文件时,这可能会导致问题。
转到工具|选项|项目和解决方案|系统上编译成功的 VC++ 目录。将“显示目录”设置为“包含文件”,然后记下显示的文件夹列表,包括该列表的顺序。
现在在编译失败的第二个系统上执行相同的操作并比较两个列表。这两个列表可能不相同。一个系统可能安装了 SDK,而另一系统则没有;两个系统可能在不同位置安装了相同的 SDK。尽管如此,列表的意图应该是相同的。
如果良好系统列表中的 DirectX SDK 条目出现在 Windows SDK 条目之前,则不良系统列表中的两个条目也应以相同的顺序出现。您必须对出现在一个列表中而不是另一个列表中的条目做出最佳判断,或者仔细实验(但请记住更改该列表可能会影响该 Visual Studio 副本执行的任何构建)。
Since the project compiles on one computer but not on another you're obviously looking for some difference between the two.
One possibility is that the two systems have different versions of the DirectX SDK installed. Not a very likely possibility perhaps but worth checking if only to eliminate it from consideration.
Another possibility is that the two systems have different versions of some other SDK installed.
A third possibility is that the two copies of Visual Studio are configured to search the include folders of the various SDKs in different orders. That can cause problems when the definition for some type or macro comes from one header file on one system and a completely different header file on the other system.
Go to Tools | Options | Projects and Solutions | VC++ Directories on the system where compiles are successful. Set "Show directories for" to "Include files" and then take note of the list of folders shown, including the order of that list.
Now do the same on the second system where the compile is failing and compare the two lists. The two lists might not be identical. One system might have an SDK installed that the other system does not; the two systems might have the same SDK installed in different places. Still, the intent of the lists should be the same.
If the DirectX SDK entry in the good system's list appears before the Windows SDK entry then the two entries in the bad system's list should appear in the same order too. You'll have to use your best judgement about entries that appear in one list but not the other - or experiment carefully (but remember changing that list could affect any build performed by that copy of Visual Studio).