Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linker error editing DirectShow source filter (VC++ 6)

Status
Not open for further replies.

TheNetFlyer

Programmer
Jun 18, 2004
4
IT
I'm editing a DirectShow source filter starting from the PushSource filter of the DXSDK9 samples.
I want to use an MPEG2 decoder internally in this filter and I try to link a library doing this.
I add it in in Project->Settings->Link form of VisualC++ 6.0 and the library is in the project folder.
A linker error appears building the project:

PushSourceMPEG.obj : error LNK2001: unresolved external symbol _avcodec_init@0
Debug_Unicode/PushSource.ax : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

It's a very strange behavior, because linking the same library in a simple MFC project there are no problems.

Anybody knows where is the bug?
Thank you.
 
in this case you should add the library manually

Ion Filipski
1c.bmp
 
yes, I try to add the library in the project following Project->Add to Project->Files... the library is shown in the source file list, but the result is the same...
 
You need to add library to the filter project's linker settings.

On your filter project, go to project settings, linker, input, and type in the path to the .lib file of the other library in the box labeled "Additional Dependencies".
 
Thank you very much!
However I have found the problem, it was very subtle...
The DirectShow filter is written in C++, but the library is compiled in C, so the "name decoration" is different. To make compatible a C library with an application written in C++ it's necessary to set to __cdecl* the calling convenction (Project->Settings->C/C++, Code Generation in the Category box). The default calling convenction in VC for a directshow filter is __stdcall.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top