DirectX 9 SDK安装后在vs2005里编译BaseClasses出错
2011-04-19 14:49
309 查看
DirectX 9 SDK安装后在vs2005里编译BaseClasses出错
先介绍系统环境:XP Professional sp2
visual studio 2005 version 8.0.50727.42
DirectX 9.0(9.0b) SDK Update - (Summer 2003)
首先,就是编译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
第一类问题的解决:错误发生在:operator=(LONG);函数定义中,这是因为在VC6中,如果没有显示的指定返回值类型,编译器将其视为默认整 形;但是vs2005不支持默认整
形,解决这个问题不能修改每个没有显示指示返回值类型的函数地方,可以用wd4430来解决;具体的在工程选项中的c+ +/Command Line中添加/wd4430即可。
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即可。当然,也可以手动改代码,增加一个声明就是了。
经过上面几个步骤,应该是可以顺利编译了,对于其它版本的工程,照样设置就可以了,总共编译出下面4个文件备用:
BaseClasses/Debug/strmbasd.lib
BaseClasses/Debug_Unicode/strmbasd.lib
BaseClasses/Release/STRMBASE.lib
BaseClasses/Release_UnicodeSTRMBASE.lib
在lib里面加入
commctrl.lib
coredll.lib
strmiids.lib
strmbase.lib
uuid.lib
ole32.lib
commdlg.lib
你或许需要在Tools->Options->Projects and solutions->vc++ directories->show directories for->library files里把它们加进去。
赶快编译DX90SDK/Samples/C++/DirectShow/Players/PlayDMO工程试试看吧。
相关文章推荐
- DirectX 9 SDK安装后在vs2010里编译BaseClasses出错问题解决方法
- 关于安装 DirectX SDk Dec 2005 后无法编译DirectShow应用程序的问题
- Qt4 SDK(mingw编译版)与VS2008/VS2005的集成开发环境的安装配置
- Linux_Hi3518 SDK 安装以及编译出错分析
- VS2005编译安装项目提示错误:验证时出错,HRESULT='80040155'
- VS2005编译安装项目提示错误:验证时出错,HRESULT='80040155'
- Linux_Hi3518 SDK 安装以及编译出错分析
- 用eclipse做的一个短信发送器,编译通过但是部署到模拟器上面出错.后来经过多方学习发现是新的sdk原因
- windows平台 vs2005 boost库安装编译(文中绿色部分是自己试验的结果)
- CentOS 7 x86_64 编译安装zabbix-2.4.2出错 MySQL library not found
- VS2005下CEGUI0.6.1安装与编译
- VS2005下如何安装配置编译Qt4
- 解决在windows下VS2010编译coldet20的出现的错误:error MSB8008: 指定的平台工具集(Windows7.1SDK)未安装或无效。
- 安装VS2005出错2349的解决办法
- EasyPR安装编译出错
- 关于MT8127中sdk的编译出错问题
- 安装多个版本gcc又卸载一个后,gcc -g选项编译出错:/tmp/cctQ99Ig.s: Assembler messages, ld returned 2 exit status
- ubuntu 16.04 编译安装g2o出错的解决方案
- ubuntu 14.04.1下安装android 4.2编译环境出错总结
- 在未安装VS2005的机器上运行VS2005编译的C++程序