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:
我得到了一个c++项目,我必须在一个不同的计算机上编译和工作。它使用的是直接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'
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.
编辑:我使用的是旧版本的ksmedia。h文件。我已将我的副本改为ksmedia。并更新错误消息以反映更改。另外,Windows和DirectX SDK版本也是相同的。然而,它所编译的计算机是32位的,它不会是64位的。
1 个解决方案
#1
1
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.
一种可能是,这两个系统安装了不同版本的DirectX SDK。也许不是很有可能,但值得检查一下,如果只是为了消除它。
Another possibility is that the two systems have different versions of some other SDK installed.
另一种可能是,这两个系统安装了其他SDK的不同版本。
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.
第三种可能是,将Visual Studio的两个副本配置为在不同的订单中搜索不同sdk的include文件夹。当某些类型或宏的定义来自一个系统上的头文件和另一个系统上的完全不同的头文件时,这可能会导致问题。
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.
在编译成功的系统中,使用|选项|项目和解决方案| vc++目录。将“显示目录”设置为“包含文件”,然后记下显示的文件夹列表,包括列表的顺序。
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.
现在,在编译失败并比较两个列表的第二个系统上执行相同的操作。这两个列表可能不一样。一个系统可能安装了另一个系统没有安装的SDK;这两个系统可能在不同的地方安装了相同的SDK。不过,列表的意图应该是相同的。
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).
如果好的系统列表中的DirectX SDK条目出现在Windows SDK条目之前,那么坏系统列表中的两个条目也应该以相同的顺序出现。您将不得不对出现在一个列表中的条目使用最好的判断,而不是其他的——或者仔细地进行实验(但是记住,更改列表可能会影响到Visual Studio的复制所执行的任何构建)。
#1
1
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.
一种可能是,这两个系统安装了不同版本的DirectX SDK。也许不是很有可能,但值得检查一下,如果只是为了消除它。
Another possibility is that the two systems have different versions of some other SDK installed.
另一种可能是,这两个系统安装了其他SDK的不同版本。
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.
第三种可能是,将Visual Studio的两个副本配置为在不同的订单中搜索不同sdk的include文件夹。当某些类型或宏的定义来自一个系统上的头文件和另一个系统上的完全不同的头文件时,这可能会导致问题。
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.
在编译成功的系统中,使用|选项|项目和解决方案| vc++目录。将“显示目录”设置为“包含文件”,然后记下显示的文件夹列表,包括列表的顺序。
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.
现在,在编译失败并比较两个列表的第二个系统上执行相同的操作。这两个列表可能不一样。一个系统可能安装了另一个系统没有安装的SDK;这两个系统可能在不同的地方安装了相同的SDK。不过,列表的意图应该是相同的。
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).
如果好的系统列表中的DirectX SDK条目出现在Windows SDK条目之前,那么坏系统列表中的两个条目也应该以相同的顺序出现。您将不得不对出现在一个列表中的条目使用最好的判断,而不是其他的——或者仔细地进行实验(但是记住,更改列表可能会影响到Visual Studio的复制所执行的任何构建)。