1.VC(custom)-DirectShow9.0在vs2005中存在的问题解决

http://hgy413.com/1270.html

解决了半天,搜了些相关资料,终于搞定,记录一下,以防意外:

首先,就是编译baseclasses,什么是baseclasses?打开你的dx的sdk安装目录,例如:
D:/DX90SDK/Samples/C++/DirectShow/
这里就有一个叫baseclasses的工程,为安全起见,请先备份此工程。

1,双击baseclasses.sln打开,提示我们需要转换工程,按提示转换就是了,编译
提示错误:
1>D:/Microsoft Visual Studio 8/VC/PlatformSDK/include/winnt.h(222) : error C2146: syntax error : missing ';' before identifier 'PVOID64'
1>D:/Microsoft Visual Studio 8/VC/PlatformSDK/include/winnt.h(222) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>D:/Microsoft Visual Studio 8/VC/PlatformSDK/include/winnt.h(5940) : error C2146: syntax error : missing ';' before identifier 'Buffer'
1>D:/Microsoft Visual Studio 8/VC/PlatformSDK/include/winnt.h(5940) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>D:/Microsoft Visual Studio 8/VC/PlatformSDK/include/winnt.h(5940) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:/DX90SDK/Samples/C++/DirectShow/BaseClasses/ctlutil.h(278) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

2,在Tools->Options->Projects and solutions->vc++ directories->show directories for里选择include files
然后增加
D:/DX90SDK/Include
D:/DX90SDK/Samples/C++/DirectShow/BaseClasses
D:/DX90SDK/Samples/C++/Common
可能会问题依旧,调整一下include files的顺序吧,把他们都放在最后,例如我的环境:
$(VCInstallDir)include
$(VCInstallDir)atlmfc/include
$(VCInstallDir)PlatformSDK/include
$(FrameworkSDKDir)include
D:/DX90SDK/Include
D:/DX90SDK/Samples/C++/DirectShow/BaseClasses
D:/DX90SDK/Samples/C++/Common
然后在project->BaseClasses properties->configuration->C/C++ -> General->Additional Include Directories里面的内容(.,../../../../include)删掉,重新编译,PVOID64的错误消失,原因如下:
POINTER_64 是一个宏,在64位编译下起作用,它包含在SDK目录下的BASETSD.H中(Microsoft Visual Studio 8/VC/PlatformSDK/Include/basetsd.h(23):#define POINTER_64 __ptr64),但DXSDK自己也带了一个basetsd.h,里面没有定义POINTER_64,从而导致出错,只需要改变include files的优先级即可。当然,也可以改写winnt.h中的代码,在下面这两行:typedef   void   *PVOID;  
typedef   void   *POINTER_64   PVOID64;
之前增加一行:
#define   POINTER_64   __ptr64

 

3.还剩下:
BaseClasses/ctlutil.h(278) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
这个错误,解决方法如下:
打开project->BaseClasses properties->configuration->C/C++ ->Command Line,增加/wd4430选项。
4,接着编译,提示error C2065: 'Count' : undeclared identifier等等错误,这个是微软的历史遗留问题了,C++标准语法的问题,因为在之前在for循环内定义的变量可以在for之外的地方使用,即在第一个for里for(int i,...),以后的for再使用i不必再声明,解决方法也很简单,打开project->BaseClasses properties->configuration->C/C++->Language->Force Comformance in For Loop Scrope设置为No即可。当然,也可以手动改代码,增加一个声明就是了。

 

Force Comformance in For Loop Scrope:强制编译器符合for循环中的局部范围

,对于其它版本的工程,照样设置就可以了,总共编译出下面4个文件备用:
BaseClasses/Debug/strmbasd.lib
BaseClasses/Debug_Unicode/strmbasd.lib
BaseClasses/Release/STRMBASE.lib
BaseClasses/Release_UnicodeSTRMBASE.lib
或许需要在Tools->Options->Projects and solutions->vc++ directories->show directories for->library files里把它们加进去。
编译DX90SDK/Samples/C++/DirectShow/Players/PlayDMO工程试试看吧。

 

 

 

 

 

你可能感兴趣的:(c,Microsoft,buffer,include,编译器)