DirectSound示例的配置

在研究音视频处理时,作者遇到使用VC6.0编译DirectSound示例时无法通过的问题,主要是缺少dxerr9.h文件的路径。在指定Include文件夹路径后,虽然解决了找不到文件的问题,但出现了编译错误。通过调整路径顺序和添加新的路径,最终解决了编译错误。然而,链接阶段又遇到了dxerr9.lib文件找不到的问题。经过进一步搜索,作者找到了问题的解决方案。

      最近开始研究音视频处理,买了本垃圾书《VC++音频/视频处理技术及工程实践》,那本书完全是照搬Direct X的帮助文档,而且还抄袭了网友“智慧的鱼“发表的博文《DirectSound开发指南》(名字可能有出入),而且还是东拼西揍,看得人云里雾里,很不爽让我伤透了心!

      于是我开始研究Direct X帮助文档,还好英语过得去,都看的懂,上面有很多具有实际参考价值的示例,于是开始研究。

用VC6.0打开,编译,却怎么都不通过,提示”Cannot open include file: 'dxerr9.h': No such file or directory“

       很明显,没有找到该文件的路径,我搜索了一下,在X:/Program Files/DirectX/Include路径下(X代表Direct X安装盘符),

于是在Tool-->Options-->Directories-->Include files下添加X:/Program Files/DirectX/Include files ,如上图,编译,结果出现如下错误:

 

Compiling...

playsound.cpp

../../common/include/DSUtil.h(50) : error C2146: syntax error : missing ';' before identifier 'm_pDS'

../../common/include/DSUtil.h(50) : error C2501: 'LPDIRECTSOUND8' : missing storage-class or type specifiers

../../common/include/DSUtil.h(50) : error C2501: 'm_pDS' : missing storage-class or type specifiers

../../common/include/DSUtil.h(57) : error C2146: syntax error : missing ';' before identifier 'GetDirectSound'

../../common/include/DSUtil.h(57) : error C2433: 'LPDIRECTSOUND8' : 'inline' not permitted on data declarations

../../common/include/DSUtil.h(57) : error C2501: 'LPDIRECTSOUND8' : missing storage-class or type specifiers

.................................

 

E:/Program Files/DirectX/Samples/C++/common/src/dsutil.cpp(438) : error C2039: 'guid3DAlgorithm' : is not a member of '_DSBUFFERDESC'

        E:/Program Files/Microsoft Visual Studio/VC98/INCLUDE/dsound.h(96) : see declaration of '_DSBUFFERDESC'

E:/Program Files/DirectX/Samples/C++/common/src/dsutil.cpp(441) : error C2227: left of '->CreateSoundBuffer' must point to class/struct/union

Error executing cl.exe.

 

playsound.exe - 32 error(s), 2 warning(s)

继续研究发现有个路径没有包含进去X:/PROGRAM FILES/DIRECTX/SAMPLES/C++/COMMON/INCLUDE,于是继续添加,编译,还是出错:内容同上。

 

 

 

后来在网上查找,发现要将插入的路径条目提到最上面去,提上去后,发现编译通过,OK!

补充:后来发现不需要X:/PROGRAM FILES/DIRECTX/SAMPLES/C++/COMMON/INCLUDE

如图:

但是链接出错,错误如下:

 

Compiling...

playsound.cpp

dsutil.cpp

Linking...

LINK : fatal error LNK1104: cannot open file "dxerr9.lib"

Error executing link.exe.

 

playsound.exe - 1 error(s), 0 warning(s)

 

看来应该是没有包含Lib库的路径,再次研究,发现要添加X:/PROGRAM FILES/DIRECTX/LIB
到Tool-->Options-->Directories-->Include files下添加X:/Program Files/DirectX/Librarys files下,好,添加,结果连接出错:
Compiling resources...
Compiling...
playsound.cpp
dsutil.cpp
dxutil.cpp
Linking...
dsutil.obj : error LNK2001: unresolved external symbol _DirectSoundCreate8@12
Debug/playsound.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
playsound.exe - 2 error(s), 0 warning(s)
记住:此路径也要提到最上面,如下图:
完成以上所有步骤后,编译通过,心情一下就爽了很多!
上编译链接成功后的图:
————2011年1月24日凌晨02:14分

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值