Compilation and debugging of DirectShow-filter development

Source: Internet
Author: User

1. Use VC to write "error lnk2005: _ dllmain @ 12 already defined" in DLL.

Use Visual C ++ to compile the DLL. If you select the mfc dll in the new project and want to write the regular DLL, you have your own dllmain () entry function, the Link error similar to the following will occur during build:

Error lnk2005: _ dllmain @ 12 already defined in XXX. OBJ

1. You only need to [project setting -- C/C ++ -- Preprocessor] in the project settings

Win32, ndebug, _ WINDOWS, _ MBCS, _ usrdll, msgbox_exports, _ Windll, _ afxdll

In _ usrdll, delete, You can compile it correctly

2

When the link sequence between the C Runtime (CRT) Library and Microsoft basic class (MFC) Library is incorrect, one of the following lnk2005 errors may occur:

Libcmtd. Lib (dbgheap. OBJ): Error lnk2005: _ free already defined in msvcrtd. Lib (msvcrtd. dll)

Solution:

Because msvcrt. Lib (msvcrt. dll) is a DLL and cannot be ignore, it should be libcmtd. Lib. in project-> Settings-> link category, select "input" option in ignore

In libraries, write libcmtd. Lib in conflict with msvcrt. Lib.

3

Nafxcwd. Lib (appcore. OBJ): Error lnk2001: unresolved external symbol ___ argv

Nafxcwd. Lib (appcore. OBJ): Error lnk2001: unresolved external symbol ___ argc

Nafxcwd. Lib (timecore. OBJ): Error lnk2001: unresolved external symbol _ mbctype

Nafxcwd. Lib (apphelp. OBJ): Error lnk2001: unresolved external symbol _ mbctype

Nafxcwd. Lib (filelist. OBJ): Error lnk2001: unresolved external symbol _ mbctype

Solution: Add: _ afxdll to project-> seting-> C/C ++-> Preprocessor definetions.

4. Errors Caused by define_guid

Guid used in filter development is as follows:

Define_guid (clsid_mpeg4_recv,

0xfea98a1b, 0x6c08, 0x4acc, 0x9d, 0xa, 0xf2, 0xab, 0x52, 0xd8, 0x43, 0x7e );

 

Define_guid (Xvid, 0x44495658, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); // xdiv Xvid MPEG-4 Codec

If initguid. H is not added anywhere, you will get a link error: "unresolved external symbol ."

  

 

 

If the same guid contains initguid. h twice, the compilation error "redefinition; multiple initialization." is returned ."

 

 

To solve these problems, make sure that initguid. h only contains once. Note: do not include initguid. h In the precompiled header file, because the precompiled header file will be included in each source file.

Use the define_guid macro to define all the required guids in files such as myguid. H. Be sure not to import initguid. H to the myguid. h header file.

Solution: for example, in crecvoutputpin: Public cbaseoutputpin;

Cmpeg4filter: Public cbasefilter;

Global variable definition

 

The myguid. h header file is used.

In this case, only the globals # include initguid. h

This header file is no longer contained elsewhere.

 5 Error c2259: 'cmpeg4filter': cannot instantiate abstract class due to following members:

 Because cmpeg4filter inherits from cbasefilter, and cbasefilter contains pure virtual functions, if the subclass does not overwrite all pure virtual functions in the base class, otherwise cmpeg4filter cannot be instantiated as an abstract class.

Therefore, to filter based on the base class, you must first find out which pure virtual functions exist in the base class.

6

 

 

C ++ Debug: Fatal error c1083: cannot open include file: 'streams. H': no such file or Directo 

Error message: Fatal error c1083: cannot open include file: 'streams. H': no such file or directory

Error cause: the file streams. h cannot be found.

Solution:

1) install DirectX SDK
2) Open dshow. DSW in the installation directory to compile
3) add
C:/dxsdk/include
C:/dxsdk/samples/C ++/DirectShow/baseclasses
C:/dxsdk/samples/C ++/common/include

C:/dxsdk/lib
C:/dxsdk/samples/C ++/DirectShow/baseclasses/debug
4) before compiling your project, add strmbasd. Lib UUID. Lib winmm. lib to the project/setting/link /.

7

I love DivX, an open-source

When the network that writes this MPEG4 stream receives the filter

At the beginning, I used the Xvid decoder to decode the received MPEG4 standard stream and then the results were garbled during vmr9 playback.

 

 

 

Excluding packet loss and Key Frame loss (the two most likely causes of Screen Display during filter development are I frames for MPEG4 streams) after that, I thought that on the sending end of the network, because my video source is one. m4e file (which contains the standard MPEG4 encoding stream) I later thought of the reason for the decoder :. the m4e Encapsulation Format does not match the decoder decoding. After considering this, I downloaded divxinstaller and installed it. After debugging in graphedt, I played vmr9 clearly and smoothly. Is DivX more universal than Xvid? Haha

8 Error lnk2001: unresolved external symbol _ imp _ timegettime @ 0

This is only because of winmm. This Lib is not added.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.