Hello,
I want to realize this thing:
Form1(Button_Click)-> Form2(Butto_Click)-> Video preview from webcam.
what I already can:
Form1(Button_Click)-> Video Preview.
I easily make form2.h under form1 and CamShow.h under form2.
But i got this error which says:
error LNK2005: "public: __thiscall WebcamShow::CamShow::CamShow(void)" (??0CamShow@WebcamShow@@QAE@XZ) is already in Form2.obj defined.
(and all the methods i declared in CamShow are mentioned just the same)
Codes for CamShow.h:
#include <DShow.h>
#include <Windows.h>
#include <comdef.h>
#define WM_GRAPHNOTIFY WM_APP+1
enum VIDEOSTATUS {Stopped, Paused, Running, Init};
namespace WebcamShow
{
public class CamShow
{
public: CamShow();
~CamShow();
public: HRESULT CamShow::InitComLib();
HRESULT CamShow::CaptureVideo(int);
......
public:
IGraphBuilder *pGraphBuilder;
ICaptureGraphBuilder *pCGB;
ICaptureGraphBuilder2 *pCGB2;
IVideoWindow *pVW;
IMediaControl *pMC;
IMediaEventEx *pME;
......
};
CamShow::CamShow()
{
pGraphBuilder = NULL;
pCGB = NULL;
pCGB2 = NULL;
pVW = NULL;
pMC = NULL;
pME = NULL;
......
}
CamShow::~CamShow() {}
HRESULT CamShow::InitComLib()
{
HRESULT hr = NULL;
hr = CoInitialize(NULL);
return hr;
}
......
Form1:
#pragma once
#include "Form2.h"
......
And Form2:
#pragma once
#include "CamShow.h"
......
i think the problem is about duplicated declarations. And i've read the msdn explaination for this error, which i don't quite understand.
How can I solve this?
Thanks!!!