最近开始研究音视频处理,买了本垃圾书《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)