原文轉自 http://blog.csdn.net/joeblackzqq/article/details/10944005
DirectX 9.0 SDK 開發包以及擴展包下載(February 2005) http://dev.csdn.net/article/62/62941.shtm。直接到微軟官網下的話,需要validation確認。
http://download.microsoft.com/download/7/b/9/7b92308a-ec8d-4016-8d45-2f91dd130bf2/dxsdk_feb2005.exe
dshow.h找不到,下個dxsdk extras就可以了。
qedit.h里面dxtrans.h missing的問題很詭異,March2008的版本依然存在這個問題,看看這篇文章http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2617687&SiteID=1
①Remove anything to do with "dxtrans.h" and "IDXEffect" .
Say, for file "qedit.h"
//#include "dxtrans.h" -- Line 498
// IDxtCompositor //: public IDXEffect -- Line 837
// IDxtAlphaSetter //: public IDXEffect -- Line 1151
// IDxtJpeg //: public IDXEffect -- Line 1345
// IDxtKey //: public IDXEffect -- Line 1735
Now, everything compiles and works fine.
②
這篇介紹direcX的配置: http://hi.baidu.com/rain_yx/blog/item/f98d9112695a8fcac2fd782c.html
You can get by with less edits of qedit.h (commenting out the missing interfaces can be error prone).
Comment out the include of dxtrans.h.
Before you include qedit.h, add the following #defines:
#define
__IDxtCompositor_INTERFACE_DEFINED__
#define
__IDxtAlphaSetter_INTERFACE_DEFINED__
#define
__IDxtJpeg_INTERFACE_DEFINED__
#define
__IDxtKey_INTERFACE_DEFINED__
#include
<qedit.h>
=====================================================================
以下為個人整理:
最初提示缺少Qedit.h, 這個需要安裝DirectX SDK Extra, 下載后解壓到一個臨時目錄,里面的主要內容是一個文件夾:Extras。我將它與我的DirectX SDK中的Extras對比了下,發現就是多了一個目錄:DirectShow,將里面的DirectShow復制到DirectX SDK安裝目錄下的Extras下,里面就有qedit.h文件。將“D:\opensource\DirectXSDK\Extras\DirectShow\Include”加入到工程的include目錄中,提示變為:無法找到dxtrans.h文件,經網上搜索,找到答案:
在#include <Qedit.h>前加上以下內容:
#pragma include_alias("dxtrans.h", "qedit.h") #define __IDxtCompositor_INTERFACE_DEFINED__ #define __IDxtAlphaSetter_INTERFACE_DEFINED__ #define __IDxtJpeg_INTERFACE_DEFINED__ #define __IDxtKey_INTERFACE_DEFINED__
再編譯,提示:
1>CaptureVideo.obj : error LNK2001: 無法解析的外部符號 _IID_ISampleGrabberCB 1>CaptureVideo.obj : error LNK2001: 無法解析的外部符號 _IID_ICreateDevEnum 1>CaptureVideo.obj : error LNK2001: 無法解析的外部符號 _CLSID_SystemDeviceEnum 1>CaptureVideo.obj : error LNK2001: 無法解析的外部符號 _CLSID_VideoInputDeviceCategory 1>CaptureVideo.obj : error LNK2001: 無法解析的外部符號 _CLSID_SampleGrabber 1>CaptureVideo.obj : error LNK2001: 無法解析的外部符號 _MEDIATYPE_Video 1>CaptureVideo.obj : error LNK2001: 無法解析的外部符號 _MEDIASUBTYPE_RGB24 1>CaptureVideo.obj : error LNK2001: 無法解析的外部符號 _PIN_CATEGORY_PREVIEW 1>CaptureVideo.obj : error LNK2001: 無法解析的外部符號 _PIN_CATEGORY_CAPTURE 1>CaptureVideo.obj : error LNK2001: 無法解析的外部符號 _IID_IBaseFilter 1>CaptureVideo.obj : error LNK2001: 無法解析的外部符號 _IID_IGraphBuilder 1>CaptureVideo.obj : error LNK2001: 無法解析的外部符號 _CLSID_FilterGraph 1>CaptureVideo.obj : error LNK2001: 無法解析的外部符號 _IID_ICaptureGraphBuilder2 1>CaptureVideo.obj : error LNK2001: 無法解析的外部符號 _CLSID_CaptureGraphBuilder2 1>CaptureVideo.obj : error LNK2001: 無法解析的外部符號 _IID_IMediaControl 1>CaptureVideo.obj : error LNK2001: 無法解析的外部符號 _IID_IVideoWindow 1>D:\program\vc2010\testa\testa.exe : fatal error LNK1120: 16 個無法解析的外部命令
很明顯,是缺少相應的lib庫文件,隨便找一個如“_IID_ISampleGrabberCB” 進行百度搜索,即可發現需要加上“strmiids.lib”。不過,添加這個lib文件前,需要將其庫目錄(D:\opensource\DirectXSDK\Extras\DirectShow\Lib\x86)添加到項目屬性中。