Directshow C++ CLR 中的未解析令牌 (0A00001x)
Unresolved Token (0A00001x) in Directshow C++ CLR
我正在尝试将PlayCap从Microsoft SDK从C++迁移到C++ CLR。
目前,我一直在直接表演课程上获得LNK2020和LNK2001。
public ref class Form1 : public System::Windows::Forms::Form
{
public:
static IVideoWindow * DC_VW = NULL;
static IMediaControl *DC_MC = NULL;
static IMediaEventEx *DC_ME = NULL;
static IGraphBuilder *DC_GB = NULL;
static ICaptureGraphBuilder2 * DC_CGB2 = NULL;
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ button1;
protected:
private: System::Windows::Forms::Panel^ panel1;
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->button1 = (gcnew System::Windows::Forms::Button());
this->panel1 = (gcnew System::Windows::Forms::Panel());
this->SuspendLayout();
//
// button1
//
this->button1->Location = System::Drawing::Point(136, 324);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(217, 53);
this->button1->TabIndex = 0;
this->button1->Text = L"button1";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// panel1
//
this->panel1->Location = System::Drawing::Point(37, 31);
this->panel1->Name = L"panel1";
this->panel1->Size = System::Drawing::Size(444, 269);
this->panel1->TabIndex = 1;
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(511, 389);
this->Controls->Add(this->panel1);
this->Controls->Add(this->button1);
this->Name = L"Form1";
this->Text = L"Form1";
this->ResumeLayout(false);
}
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
HRESULT hr;
IBaseFilter *DC_SF = NULL;
hr = GetInterfaces();
if(FAILED(hr))
{
int x = ::MessageBox(NULL, (LPCWSTR)L"Failed to get interfaces. hr=0x%x", (LPCWSTR)L"OK", MB_OK);
}
hr = DC_CGB2->SetFiltergraph(DC_GB);
if(FAILED(hr))
{
int x = ::MessageBox(0, (LPCWSTR)L"failed to set filter graph hr=0x%x", (LPCWSTR)L"OK", MB_OK);
}
//hr = FindCaptureDevice(&DC_SF);
}
private: HRESULT GetInterfaces(void)
{
HRESULT hr;
void* Temp;
hr = CoCreateInstance (CLSID_FilterGraph, NULL, CLSCTX_INPROC, IID_IGraphBuilder, (void **) &Temp);
DC_GB = (IGraphBuilder*)Temp;
if(FAILED(hr))
{
return hr;
}
hr = CoCreateInstance (CLSID_CaptureGraphBuilder2, NULL, CLSCTX_INPROC, IID_ICaptureGraphBuilder2, (void **)&Temp);
DC_CGB2 = (ICaptureGraphBuilder2*)Temp;
if(FAILED(hr))
return hr;
hr = DC_GB->QueryInterface(IID_IMediaControl, (LPVOID*) &Temp);
DC_MC = (IMediaControl*)Temp;
if(FAILED(hr))
return hr;
hr = DC_GB->QueryInterface(IID_IVideoWindow, (LPVOID*) &Temp);
DC_VW = (IVideoWindow*)Temp;
if(FAILED(hr))
return hr;
hr = DC_GB->QueryInterface(IID_IMediaEventEx, (LPVOID*) &Temp);
DC_ME = (IMediaEventEx*)Temp;
if(FAILED(hr))
return hr;
hr = DC_ME->SetNotifyWindow(panel1->Handle.ToInt64(), WM_APP+1, 0);
return hr;
}
};
到目前为止,这几乎是PlayCap代码的要点,除了我必须移动声明并使它们成为静态的。
我不断得到
1>DirectshowC++.obj : error LNK2020: unresolved token (0A000012) IID_IMediaEventEx
1>DirectshowC++.obj : error LNK2020: unresolved token (0A000013) IID_IVideoWindow
1>DirectshowC++.obj : error LNK2020: unresolved token (0A000014) IID_IMediaControl
1>DirectshowC++.obj : error LNK2020: unresolved token (0A000016) CLSID_CaptureGraphBuilder2
1>DirectshowC++.obj : error LNK2020: unresolved token (0A000017) IID_ICaptureGraphBuilder2
1>DirectshowC++.obj : error LNK2020: unresolved token (0A000018) CLSID_FilterGraph
1>DirectshowC++.obj : error LNK2020: unresolved token (0A000019) IID_IGraphBuilder
1>DirectshowC++.obj : error LNK2001: unresolved external symbol IID_IMediaEventEx
1>DirectshowC++.obj : error LNK2001: unresolved external symbol IID_IVideoWindow
1>DirectshowC++.obj : error LNK2001: unresolved external symbol IID_IMediaControl
1>DirectshowC++.obj : error LNK2001: unresolved external symbol IID_ICaptureGraphBuilder2
1>DirectshowC++.obj : error LNK2001: unresolved external symbol CLSID_CaptureGraphBuilder2
1>DirectshowC++.obj : error LNK2001: unresolved external symbol IID_IGraphBuilder
1>DirectshowC++.obj : error LNK2001: unresolved external symbol CLSID_FilterGraph
所有这些都在strmif.h头文件中,它找到文件和它们,但idk链接器错误是怎么回事
你可能想链接到strmiids.lib和strmbase.lib。
相关文章:
- 如何在C++中使用X509证书模在令牌中查找私钥
- holeMenuProgram.cpp:38:1 错误:'}'令牌之前的预期主表达式
- C++:"("令牌"之前有预期的非限定 id 指向类中成员函数的指针
- Arduino 用于语句错误。令牌之前的预期')' ';'。如何解决这个问题?
- 错误:令牌 { '{' 之前应存在非限定 ID
- 允许哪些令牌作为 #include 的参数?
- "错误 C0000:语法错误,令牌"<EOF>"处出现意外$end,并且不确定
- 它在 { 令牌之前给了我预期的标识符
- (错误:令牌之前'<<'预期的主表达式)
- 为什么 ## aka 令牌粘贴运算符不适用于 C 和 C++ 中的注释?
- 错误:"->"令牌之前的预期初始值设定项
- LINUX 操作系统上的错误:令牌之前预期的构造函数、析构函数或类型转换'('?
- 丢失读入的每一行输入中的最后一个令牌
- 如何使用 libCurl 将访问令牌发送到服务器 API
- C++令牌定义成员
- 宏定义中的预处理器令牌两边有两个双引号
- 错误:C++中']'令牌之前的预期主表达式
- 错误:令牌之前的预期主表达式'&&'
- 令牌之前']'预期的主表达式?
- Directshow C++ CLR 中的未解析令牌 (0A00001x)