VS 2005下DirectShow开发环境的配置 2011.06.17
来源:互联网 发布:申请网络出版要多久 编辑:程序博客网 时间:2024/05/17 04:20
[1] 请确保您的机子上已经安装了VS 2005和DirectX 9.0b SDK。DX9.0 SDK的下载地址就不写了,自己在网上找吧!(我的DX9.0安装在D盘根目录下) [2] 首先编译SamplesC++DirectShowBaseClasses目录下的baseclasses.sln以得到两个库文件(strbase.lib和strmbase.lib)。以下介绍的主要是如何修改编译中的错误,这也是众多文章中没有叙述的部分。自己写的,有些啰嗦,请原谅哦! 进入DirectShow的安装目录,找到SamplesC++DirectShowBaseClasses,双击baseclasses.sln打开该解决方案。首先看到的会是Visual Studio的转换向导,不用管它,直接Next到Finish。 点击F5,调试运行,你会见到下面的错误(至少我编译的时候就是这样的结果): 1>------ Build started: Project: BaseClasses, Configuration: Debug Unicode Win32 ------ 没办法,改错。(网上老外的文章中说过,不过也不明白什么意思!) 双击1>D:Program FilesMicrosoft Visual Studio 8VCPlatformSDKincludewinnt.h(222) : error C2146: syntax error : missing ';' before identifier 'PVOID64' 跳转到出错的位置。 你会见到错误语句:typedef void * POINTER_64 PVOID64; 这样的定义,VS2005中是不支持的。将其修改为两条语句: #define POINTER_64 __ptr64 然后调试运行,会发现还有1条错误: 1>------ Build started: Project: BaseClasses, Configuration: Debug Unicode Win32 ------ 只有继续改啦!双击1>d:DXSDKSamplesC++DirectShowBaseClassesctlutil.h(278) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 跳转到出错的位置。 你会见到错误语句:operator=(LONG); 只是没有返回值嘛!给它加一个就行了,将其改为:LONG operator=(LONG); 再次调试运行,哇塞!更多错误: 1>------ Build started: Project: BaseClasses, Configuration: Debug Unicode Win32 ------ 有错就改啦!双击1>.wxdebug.cpp(567) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 跳到出错位置。 你会见到出错语句:static g_dwLastRefresh = 0; 静态类型变量有这么定义的吗?总得给个类型吧!将其改为:static DWORD g_dwLastRefresh = 0;为什么类型指定为DWORD?看程序中的语句就明白了——保证相同类型的变量进行运算。 再次调试运行: 1>------ Build started: Project: BaseClasses, Configuration: Debug Unicode Win32 ------ 错误少了一个哦!继续努力!双击1>.winutil.cpp(2104) : error C2065: 'Count' : undeclared identifier跳到出错位置。 你会见到出错语句:for (Count = 0;Count < Result;Count++) { Count没有定义?看该语句上面的语句: for (UINT Count = 0;Count < Result;Count++) { // And likewise compare against the last ten entries Result = GetSystemPaletteEntries(hdc,PalHiStart,PalLoCount,SystemEntries); 看到了吧!Count是在循环体内定义的变量,出了循环之后就“生命”over了。所以将它定义到外面去。将以上的语句改为: UINT Count = 0; for (Count = 0;Count < Result;Count++) { // And likewise compare against the last ten entries Result = GetSystemPaletteEntries(hdc,PalHiStart,PalLoCount,SystemEntries); 再次调试运行: 1>------ Build started: Project: BaseClasses, Configuration: Debug Unicode Win32 ------ 不错哦!错误剩下一个了!再改,双击1>.outputq.cpp(664) : error C2065: 'iDone' : undeclared identifier 你会见到出错语句:*nSamplesProcessed = iDone - iLost; iDone没有定义?OK,继续看它上面的语句: // Loop processing the samples in batches LONG iLost = 0; // ... 同样的,将iDone的定义放到循环体的外面去,改为: // Loop processing the samples in batches LONG iLost = 0; long iDone = 0; // ... 改完了以后,再次调试运行: 1>------ Build started: Project: BaseClasses, Configuration: Debug Unicode Win32 ------ 总算见到succeeded了,呵呵!你调出来了吗? 接着,生成所需要的那几个库文件,步骤如下: 单击VS2005菜单栏中的Build-->Batch Build-->单击弹出的Batch Build对话框中的Select All按钮-->单击Build按钮。生成我们编程所需要的那两个库文件:strbase.lib和strmbase.lib。 [3] 将DirectX SDK的Include和Lib目录配置到VS2005的系统目录中去,并且放在标准的VS2005目录之前。步骤如下: 单击VS2005菜单栏上的Option(选项)-->单击弹出的Option对话框中Projects and Solutions前的加号将其展开-->单击VC++ Directories--> (1) 在show directories for下拉列表中选中Include files,然后添加下列路径: D:DXSDKInclude D:DXSDKSAMPLESC++DIRECTSHOWBASECLASSES D:DXSDKSAMPLESC++COMMONINCLUDE (2) 在show directories for下拉列表中选中library files,然后添加下列路径: D:DXSDKLib D:DXSDKSamplesC++DirectShowBaseClassesDebug D:DXSDKSamplesC++DirectShowBaseClassesDebug_Unicode D:DXSDKSamplesC++DirectShowBaseClassesRelease D:DXSDKSamplesC++DirectShowBaseClassesRelease_Unicode 路径添加完成以后,别忘了点确定哦! [4] 这一步只是简单的介绍一下编程时需要附加什么样的库文件及如何添加。 DirectShow应用程序应该至少连接库文件strmiids.lib和quartz.lib。前者定义了DirectShow标准的CLSID和IID,后者定义了导出函数AMGetErrorText(如果应用程序中没有使用到这个函数,也可以不连接这个库)。 如果程序里包含了头文件streams.h,则一般库文件还要连接strmbasd.lib、uuid.lib、winmm.lib。 如果你不知道怎样附加库文件的话,可以试下下述的步骤: (1) 首先你得新建或打开一个解决方案。 (2) 单击VS2005菜单栏中的Project-->XXX Properties-->弹出属性设置对话框,展开Configuration Properties-->展开Linker-->单击Input-->在右边的Addtional Dependencies中添加库。在每个库文件中以空格间隔。 例如:strbase.lib strmiids.lib [5] 全部搞定了之后,你就可以放心的写程序,调试程序了。加油哦!
1>Compiling...
1>dllentry.cpp
1>D:Program FilesMicrosoft Visual Studio 8VCPlatformSDKincludewinnt.h(222) : error C2146: syntax error : missing ';' before identifier 'PVOID64'
1>D:Program FilesMicrosoft Visual Studio 8VCPlatformSDKincludewinnt.h(222) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>D:Program FilesMicrosoft Visual Studio 8VCPlatformSDKincludewinnt.h(5940) : error C2146: syntax error : missing ';' before identifier 'Buffer'
1>D:Program FilesMicrosoft Visual Studio 8VCPlatformSDKincludewinnt.h(5940) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>D:Program FilesMicrosoft Visual Studio 8VCPlatformSDKincludewinnt.h(5940) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:DXSDKSamplesC++DirectShowBaseClassesctlutil.h(278) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:DXSDKincludeuuids.h : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
1>Build log was saved at "file://d:DXSDKSamplesC++DirectShowBaseClassesDebug_UnicodeBuildLog.htm"
1>BaseClasses - 6 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
typedef void *PVOID;
typedef void *POINTER_64 PVOID64;
1>Compiling...
1>dllentry.cpp
1>d:DXSDKSamplesC++DirectShowBaseClassesctlutil.h(278) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:DXSDKincludeuuids.h : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
1>Build log was saved at "file://d:DXSDKSamplesC++DirectShowBaseClassesDebug_UnicodeBuildLog.htm"
1>BaseClasses - 1 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
1>Compiling...
1>wxdebug.cpp
1>.wxdebug.cpp(534) : warning C4996: '_vsnwprintf' was declared deprecated
1> D:Program FilesMicrosoft Visual Studio 8VCincludestdio.h(450) : see declaration of '_vsnwprintf'
1> Message: 'This function or variable may be unsafe. Consider using _vsnwprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See _disibledevent="file:///d:DXSDKSamplesC++DirectShowBaseClassesDebug_UnicodeBuildLog.htm">file://d:DXSDKSamplesC++DirectShowBaseClassesDebug_UnicodeBuildLog.htm"
1>BaseClasses - 10 error(s), 2 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
1>Compiling...
1>winutil.cpp
1>.winutil.cpp(2104) : error C2065: 'Count' : undeclared identifier
1>.winutil.cpp(2106) : error C2228: left of '.peRed' must have class/struct/union
1>.winutil.cpp(2106) : error C2228: left of '.peRed' must have class/struct/union
1>.winutil.cpp(2107) : error C2228: left of '.peGreen' must have class/struct/union
1>.winutil.cpp(2107) : error C2228: left of '.peGreen' must have class/struct/union
1>.winutil.cpp(2108) : error C2228: left of '.peBlue' must have class/struct/union
1>.winutil.cpp(2108) : error C2228: left of '.peBlue' must have class/struct/union
1>.winutil.cpp(2124) : error C2228: left of '.peFlags' must have class/struct/union
1>outputq.cpp
1>.outputq.cpp(664) : error C2065: 'iDone' : undeclared identifier
1>Generating Code...
1>Build log was saved at "file://d:DXSDKSamplesC++DirectShowBaseClassesDebug_UnicodeBuildLog.htm"
1>BaseClasses - 9 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
if (SystemEntries[Count].peRed != pEntry[Count].peRed ||
SystemEntries[Count].peGreen != pEntry[Count].peGreen ||
SystemEntries[Count].peBlue != pEntry[Count].peBlue) {
bIdentityPalette = FALSE;
}
}
if (SystemEntries[Count].peRed != pEntry[Count].peRed ||
SystemEntries[Count].peGreen != pEntry[Count].peGreen ||
SystemEntries[Count].peBlue != pEntry[Count].peBlue) {
bIdentityPalette = FALSE;
}
}
1>Compiling...
1>winutil.cpp
1>outputq.cpp
1>.outputq.cpp(664) : error C2065: 'iDone' : undeclared identifier
1>Generating Code...
1>Build log was saved at "file://d:DXSDKSamplesC++DirectShowBaseClassesDebug_UnicodeBuildLog.htm"
1>BaseClasses - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
跳到出错位置。
for (long iDone = 0;
iDone < nSamples || (m_nBatched != 0 && m_bSendAnyway);
) {
for (iDone = 0;
iDone < nSamples || (m_nBatched != 0 && m_bSendAnyway);
) {
1>Compiling...
1>outputq.cpp
1>Creating library...
1>Build log was saved at "file://d:DXSDKSamplesC++DirectShowBaseClassesDebug_UnicodeBuildLog.htm"
1>BaseClasses - 0 error(s), 0 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
- VS 2005下DirectShow开发环境的配置 2011.06.17
- 转: VS 2005下DirectShow开发环境的配置
- VS 2005下DirectShow开发环境的配置
- DirectShow 在VS下的环境配置
- VS 2005下DirectShow开发环境的配置 2010-10-11 18:28
- directshow的开发环境配置
- Directshow的开发环境配置
- VC6.0下DirectShow开发环境配置
- DirectShow开发环境配置
- DirectShow 开发环境配置
- DirectShow开发的环境配置和常见问题
- 给vc配置DirectShow的开发环境
- VS2005 directshow 编译开发环境的配置
- directshow环境的配置
- VC6.0下配置DirectShow开发环境方法
- XP + VS2010 下配置 DirectShow SDK 开发环境
- VC6 下配置DirectShow SDK开发环境及下载地址
- VC6配置DIRECTSHOW开发环境
- 用光纤还是用网线 光纤局域网设备导购
- Bridge-utils 开发移植
- linuxC开发调式工具
- Android实现TCP与UDP传输
- Linux下 Weblogic集群
- VS 2005下DirectShow开发环境的配置 2011.06.17
- FLEX SharedObject介绍及应用
- 设置自定义的Edittext的光标是否显示和被选中文字的背景色
- java API 帮助文档
- Wifi Porting for Android 2.3
- 浅谈互联网页面价值
- KB2530548
- 如何在Windows下搭建Android开发环境(转载)
- spinlock和semaphore的差别和应用