編譯一些網上的directshow的例子時候,總會遇到各種各樣的問題,下面搜集如下:

來源:互聯網
上載者:User
 appear to still be having problems with linking errors, i've managed to narrow it down to a few lines of code which cause the problem

Following the PushSource filter sample within the Platform SDK:

// directshow includes

#include

<streams.h>

#include

<initguid.h>

#include

<Qedit.h> // for ISampleGrabber

#include

<dvdmedia.h>

{8B578D13-87B2-488f-A4C1-AC8D065590D3}
DEFINE_GUID(CLSID_MyPushSource, 0x8b578d13, 0x87b2, 0x488f, 0xa4, 0xc1, 0xac, 0x8d, 0x6, 0x55, 0x90, 0xd3);

class MyPushSource : public CSource
{
public:
 MyPushSource(IUnknown *pUnk, HRESULT *phr);
};

MyPushSource::MyPushSource(IUnknown *pUnk, HRESULT *phr)
 : CSource(NAME("MyPushSource"), pUnk, CLSID_MyPushSource)
{
 // do nothing yet
}

This code causes the following linking errors:

1>dracscrp.obj : error LNK2001: unresolved external symbol "public: virtual long __stdcall CSource::FindPin(unsigned short const *,struct IPin * *)" (?FindPin@CSource@@UAGJPBGPAPAUIPin@@@Z)
1>dracscrp.obj : error LNK2001: unresolved external symbol "public: virtual long __stdcall CBaseFilter::JoinFilterGraph(struct IFilterGraph *,unsigned short const *)" (?JoinFilterGraph@CBaseFilter@@UAGJPAUIFilterGraph@@PBG@Z)
1>dracscrp.obj : error LNK2001: unresolved external symbol "public: virtual long __stdcall CBaseFilter::QueryVendorInfo(unsigned short * *)" (?QueryVendorInfo@CBaseFilter@@UAGJPAPAG@Z)

The libraries which are included in my solution are:

strmbase.lib strmiids.lib quartz.lib winmm.lib vfw32.lib odbc32.lib odbccp32.lib atls.lib comsupp.lib

I feel I must have missed something, or have the newest DirectX SDK, and Platform SDK not got anything about the CSource any more, its really confusing me.

=================解決方案=====================

Look out for "Treat wchar_t as Built in type" option on the C/C++ Language tab. If you've been using an older version of strmbas* built from the base classes, you could have said "No" to this option. Change it back to "Yes".

還有一些連結錯誤,可以如下改正:
開啟c/c++ >> Language >> Treat wchar_t as Built-in Type 設為 Yes.
Runtime Library ---->> Multi-threaded Debug(/MTd)

相關關鍵詞:
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.