Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.

Linking Issues with Media SDK and Visual Studio 2012

Tim_S_
Beginner
736 Views

Dear Support:

I am building a C++ application using Visual Studio and am able to compile the Media SDK API calls successfully, but when I get to the linking stage, I am getting unresolved external symbol issues - please see attached file for example output from the linker.  Also I have attached the output from running mediasdk_sys_analyzer as well.  I am including the library "libmfx.lib" in my project and am not getting any complaints about it not being able to find this library, but why would I be having external symbol issues if this library is included in my project?  Please advise.

Thanks,
Tim

0 Kudos
8 Replies
Surbhi_M_Intel
Employee
737 Views

Hi Tim,

From the sys analyzer report, it seems that the HW version of Intel Media SDK is not supported on your system. You should install latest driver from downloadcenter.intel.com and use Intel as you default driver. I believe that should resolve your problem. Please reply to the forum if you still see the issue.

Thanks,
-Surbhi

0 Kudos
Tim_S_
Beginner
737 Views

Hey Surbhi:

I have done the update as you suggested, but still the same problem.  Please see the attched file from Visual Studio 2012 from the build - there is a bunch of linker errors at the bottom indicating that it can't find certain Media SDK symbols.  I have added the file "Source.cpp" file to this project which references Media SDK API calls.  I have attached this file.  It compiles ok, but fails during the linking stage.  If I remove this file from my project, it builds ok.  Any idea as to what may be the problem?

Thanks,
TIm

0 Kudos
Tim_S_
Beginner
737 Views

Dear Support:

This problem is the same one now that I have already entered under the title "Linking Issues with Media SDK and Visual Studio 2012".  I am copying my last post that I made below:

Dear Support:

I think I found the problem here. It's due to my project being a Microsoft MFC application and it wants to use MFC as a shared DLL or as a static library and won't work when specifying to "Use Standard Windows Libraries". I created another empty project where I could add this "Source.cpp" file that I had created and it built and worked fine as long as I chose "Use Standard Windows Libraries". I also noticed that the sample_decoder that comes with the Media SDK is built this way as well using "Use Standard Windows Libraries". So now my question is how do I get the Media SDK library "libmfx.lib" to build with an application that uses MFC in a static library or shared DLL? Once I get this to build ok, I think I'm there. Please help...

Thanks,
Tim

0 Kudos
Surbhi_M_Intel
Employee
737 Views

Hi Tim, 

I have used sample_decode to build with MFC in a static Library and MFC in a shared DLL in Visual Studio 2013 and doesn't encounter any issue in compiling and running the sample.
Couple of Suggestion which might can help you- 
1. Please ensure INTELMEDIASDKROOT variable is set. You can find details how to set it in this article. 
2. You can check dispatcher also, which is an open source which comes with Media SDK. May be modifying it, can help in your situation.

Thanks,
-Surbhi

 

0 Kudos
Tim_S_
Beginner
737 Views

Hey Surbhi:

Thanks for your response.  I have double checked that the INTELMEDIASDKROOT is set correctly.  I did a test where I created a .cpp file with Media SDK API calls and put it in a project where I created it using MFC and one without using MFC.  The project without MFC built and linked with no issues.  But the one with MFC failed with the same link errors that I was having earlier with my larger project.

Is there anything that you do differently with the MFC project properties to get the Media SDK to build and link correctly?  Strange that the same code would build ok without MFC vs with MFC. 

When you say "check dispatcher" what do you mean?  I see there is a project called "mfx_dispatch" in the opensource directory of my SDK root directory.  Are you referring to this and if so, what should I do with it?  Please advise.

Thanks,
Tim

0 Kudos
Surbhi_M_Intel
Employee
737 Views

Hi Tim,

Quoting from developer's guide - 
"The media dispatching library, or dispatcher, is the gateway to Intel® Media SDK. This is statically linked to all Intel Media SDK-enabled programs. The dispatcher is responsible for exposing the entry points for the encoding, decoding, and video preprocessing routines. Dispatcher is also responsible for detecting and loading the appropriate implementation library for the client machine."

mfx_dispatcher projects builds libmfx.lib (the problem you were seeing to link it). Current sample just links with a pre-built libmfx.lib, so you can use the open source code to build it again and see if that helps. It is present in <installed folder>\opensource\mfx_dispatch.
Other thing you can do is to remove linking with .lib at all and put mfx_dispatcher code in the project. You can find more details about mfx_dispatcher in developers guide and manual.
As a heads up, there is an issue with opensource code that would make the application not find Media SDK, if you have multiple adapters. We soon have solution for this. Issue has been discussed in this post - https://software.intel.com/en-us/forums/topic/519877 

Another issue could be with the Visual studio, I hope you are not using express version, because there are some constraints which might be creating issue to build the project with MFC. 
To be on the same page, these are the steps I am doing- using sample_decode, change to use MFC : project properties -> Configration properties->General->Project defaults->use of MFC, here i am changing it to use of MFC in static library or use of MFC in Shared DLL. and running the code and using Visual Studio Ultimate 2013. Let me know what steps you are taking if you still see the issue.

Thanks,
-Surbhi

 

0 Kudos
Tim_S_
Beginner
737 Views

Hey Surbhi:

Excellent response - many thanks for your comments and advice.  I obviously misunderstood what I was supposed to do.  Because I was on a 64-bit machine, I thought I needed to use the library from the lib/x64 directory.  However I was building my projects with a Platform of Win32 - hence the problem.  I needed to use lib/win32 instead.  However that was not all of it.  I also had to choose Linker->Input->Ignore Specifc Default Libraries using "msvcrt.lib, msvcrtd.lib and libcmt.lib" and then that fixed the problem such that I could build the project.  I was not using the express version of VS - using the professional version.  Seeing what was going on with the dispatcher and how it was created helped me to understand the problem and find a fix.  Thanks for your advice and working with me through all of this.  It wasn't pleasant - would much rather have gone to the dentist and had a few teeth pulled out!  I should be good to go now to make some good progress.

Thanks,
Tim

0 Kudos
Surbhi_M_Intel
Employee
737 Views

Hi Tim,

I am glad that you were able to figure out and your code is working! As your problem has been resolved, I will be closing this post. Please let us know if you encounter any issues with Media SDK.

Thanks,
-Surbhi
 

0 Kudos
Reply