Click here to Skip to main content
15,887,434 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
For the code below I am getting LNK2019 error. The complier cannot recognize MFXInit, MFXClose, MFXQueryVersion. It doesn't show the error for other functions within 'mfxvideo.h'.

C++
#include "mfxvideo.h"
#include<stdio.h>

//Please refer the mediasdk-man.pdf provided under *\IntelSWTools\Intel(R)_Media_SDK_2016.0.2\doc
//The program is meant for educational purposes. At the time it was written the author was learning the...
//used API.
//Based on **Intel Media SDK**


int main() {
	//Here the version of the API used is defined for the software and hardware version
	mfxVersion SWversion = { 0,1 }, version, HWversion = { 0,1 };
	
	//Initializing a session. This should be done for all the programs written using this API
	mfxSession SWsession, HWsession;
	
	// is used to monitor the progress of program and analyse errors, if any arise.
	//Based on the progress we decide the optimal path for progressing our code(With practice...
	//...this will become clearer)
	mfxStatus sts;

	//Setting the value for 'sts' using  we initialize the SDK session
	// takes following arguments (desired implementation[here we have chosen software]...
	//... , pointer for desired version, pointer for desired session)
	sts = MFXInit(MFX_IMPL_SOFTWARE, &SWversion, &SWsession);

	//Now using the 'sts; we check for errors. As mentioned earlier based on the value of sts...
	//... we allow our program to choose the optimal path for proceeding
	// signifies that there are no error observed by the variable 'sts'
	if (MFX_ERR_NONE == sts)
	{
		// finds out the implementation version of the SDK for a given session
		MFXQueryVersion(SWsession, &version);
		printf("SW version: %d.%d \n API level: %d.%d\n",
			SWversion.Major, SWversion.Minor, version.Major, version.Minor);
	}

	//Repeating the above procedure for hardware based implpementation
	
	sts = MFXInit(MFX_IMPL_HARDWARE, &HWversion, &HWsession);

	if (MFX_ERR_NONE == sts)
	{
		MFXQueryVersion(HWsession, &version);
		printf("HW version: %d.%d \n API level: %d.%d\n",
			HWversion.Major, HWversion.Minor, version.Major, version.Minor);
	}

	MFXClose(SWsession);
	MFXClose(HWsession);

	return 0;
}


What I have tried:

1-I have linked the project by going to
Solution>Right Click>Properties>a), and b)
a) C/C++>General>Additional Include Directories> *\IntelSWTools\Intel%28R%29_Media_SDK_2016.0.2\include;%(AdditionalIncludeDirectories)
b)Linker>General>Additional Library Directories> *\IntelSWTools\Intel%28R%29_Media_SDK_2016.0.2\lib;%(AdditionalLibraryDirectories)
2-Visual Studio 2017RC Documentation Webpage
3-Executed the program on different version of Visual Studio(Namely 2012) and Code::Blocks 13.12 (In Code::Blocks the compiler cannot recognize the mentioned functions)
Posted
Updated 30-Jul-17 17:27pm
Comments
Afzaal Ahmad Zeeshan 31-Dec-16 11:03am    
Visual Studio 2017, is not published and it is guaranteed to break many things every now and then. Try using Visual Studio 2015 until for a while and see if that works or not.
theRealGreenz1 31-Dec-16 12:11pm    
Thanks, Afzaal Ahmad Zeeshan for your interest in this question. I will try to find a system with VS2015 and revert back. Please do consider that Code::Blocks also showed similar error along with Visual Studio 2012.
theRealGreenz1 3-Jan-17 3:34am    
The specific issue related to my problem has been solved. Thanks for your input.
Richard MacCutchan 31-Dec-16 11:43am    
You have not added the actual MFX library name in your linker properties.
theRealGreenz1 31-Dec-16 12:04pm    
Thanks Richard for your interest. Doesn't '1b' under 'What I have tried' section direct towards the same? The following directory: '*\IntelSWTools\Intel%28R%29_Media_SDK_2016.0.2\lib\x64' has the required library 'libmfx.lib'.

So try exactly the same thing in VS2015 and see if it works.
If it does, then report the problem to MS so they can fix it before release.
If it doesn't, then it's probably you've forgotten to link a library or similar.
either way, we probably aren't the people you need to talk to.
 
Share this answer
 
Comments
theRealGreenz1 31-Dec-16 12:07pm    
Thanks OriginalGriff for your answer. I tried VS2012 and Code::Blocks 13.12. I will try to find a system with VS2015 and revert back ASAP.
add legacy_stdio_definitions.lib then ok.
 
Share this answer
 
Comments
Graeme_Grant 30-Jul-17 23:36pm    
This question is over 7 months old and the OP has already accepted an answer. Please do not offer solutions to old tombstoned questions or question that have already accepted answers. Please put your efforts into current questions that require assistance.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900