主题:[讨论]Visual C++编程实现摄像头视频捕捉
tokushima
[专家分:0] 发布于 2006-04-13 21:23:00
用 vc 编程实现摄像头视频捕捉 。我找了一篇文章,地址如下
http://www.programfan.com/article/showarticle.asp?id=2868
我按文章的要求去做,装了DirectX9 SDK ,并导入了Strmiids.lib Quartz.lib 这两个库,在 xp vc 下运行,出现这样的错误
--------------------Configuration: test - Win32 Debug--------------------
Compiling...
CaptureVideo.cpp
c:\test\capturevideo.h(36) : error C2143: syntax error : missing ';' before '*'
c:\test\capturevideo.h(36) : error C2501: 'ICaptureGraphBuilder2' : missing storage-class or type specifiers
c:\test\capturevideo.h(36) : error C2501: 'm_pCapture' : missing storage-class or type specifiers
c:\test\capturevideo.h(40) : error C2065: 'ISampleGrabber' : undeclared identifier
c:\test\capturevideo.h(40) : error C2955: 'CComPtr' : use of class template requires template argument list
c:\program files\microsoft visual studio\vc98\atl\include\atlbase.h(563) : see declaration of 'CComPtr'
c:\test\capturevideo.h(40) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Error executing cl.exe.
test.exe - 6 error(s), 0 warning(s)
用DirectX9 SDK 编程还要什么设置吗?导入Strmiids.lib Quartz.lib ,是project->
setting->Link->Object/library moudules 中加入的,在Tools->Directories->Library files 中也加入了相关的目录,编译的程序是 MFC AppWizard(exe) 程序,不是向导中的DirectX 9 AppWizard 生成的程序。
谢谢指导。
回复列表 (共31个回复)
沙发
lusuo [专家分:10100] 发布于 2006-04-14 09:50:00
你连最基本的看错误都看不来!你的*号前多了个;号等等基本错误都不会修改
基本的类型声明错误都没看出来,
我觉得你还没会走,就跑的太凶了吧!好好把基本知识学了在做这种有点难度的
板凳
tokushima [专家分:0] 发布于 2006-04-14 11:45:00
谢谢楼上的建议,我会洗耳恭听的。不过,不知道你有没按那篇文章所讲的去做一遍?
从编译的错误提示来看,是少了';',而不是多了';' 。
c:\test\capturevideo.h(36) : error C2143: syntax error : missing ';' before '*'
这个错误是指这一行 ICaptureGraphBuilder2 * m_pCapture;
这一行从语法上来看,并没有错误,也没有少了';',是编译器不认识ICaptureGraphBuilder2 ,这种情况应该是少了某个头文件,所以我想问用Directx编程还要有什么设置?
3 楼
mroske [专家分:1340] 发布于 2006-04-14 12:56:00
可能你没有包含dshow.h 这个头文件吧
4 楼
tokushima [专家分:0] 发布于 2006-04-14 13:22:00
包含了。如果没有的话,编译器会停在 # include "dshow.h" 这一行,指出找不到这个文件。我在Tools->Directories->Include files 中也增加了dshow.h 所在的目录 。
5 楼
tokushima [专家分:0] 发布于 2006-04-20 13:26:00
不会吧?没人知道?我晕了。
6 楼
ynzl006 [专家分:0] 发布于 2006-04-21 15:15:00
你没有包含Streams.h头文件吧
7 楼
emmett [专家分:2420] 发布于 2006-04-22 11:03:00
将\DXSDK\samples\ Multimedia\ DirectShow\ BaseClasses\baseclasses.dsw 工程重新编译生成strmbasd.lib文件,复制到\DXSDK\LIB文件夹下。
在VC6.0中设置
tools\options\Directories\include files
C:\DXSDK\INCLUDE
tools\options\Directories\Library files
C:\DXSDK\LIB
8 楼
tokushima [专家分:0] 发布于 2006-04-25 17:50:00
谢谢 emmett如此详细的说明,谢谢,也谢谢所有关注的朋友。
前几天,我按另一位朋友的指点,在 stdafx.h 文件中加入 #include <wtypes.h>
然后我说的错误就解决了,但是出现新的错误,错误如下
--------------------Configuration: test - Win32 Debug--------------------
Linking...
LINK : fatal error LNK1104: cannot open file ",.obj"
Error executing link.exe.
test.exe - 1 error(s), 0 warning(s)
这个就有点搞不懂了,什么 .obj 打不开?除了 .lib .h文件外还要 .obj文件吗?而且它又没具体说明是哪个文件打不开。还望大家继续关注。谢谢。
9 楼
tokushima [专家分:0] 发布于 2006-04-25 17:56:00
在VC6.0中设置
tools\options\Directories\include files
C:\DXSDK\INCLUDE
tools\options\Directories\Library files
C:\DXSDK\LIB
这两个之前也作好了。
10 楼
erliqq [专家分:310] 发布于 2006-04-26 15:35:00
capturevideo.h(40) : error C2065: 'ISampleGrabber' : undeclared identifier
capturevideo.h(40) : error C2955: 'CComPtr' : use of class template requires template argument list
d:\program files\microsoft visual studio\vc98\atl\include\atlbase.h(563) : see declaration of 'CComPtr'
\capturevideo.h(40) : fatal error C1903: unable to recover from previous error(s); stopping compilation
我来回复