使用visual studio 2017RC时出现LNK2019错误 [英] Error LNK2019 using visual studio 2017RC

查看:173
本文介绍了使用visual studio 2017RC时出现LNK2019错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于下面的代码,我收到LNK2019错误。编译器无法识别MFXInit,MFXClose,MFXQueryVersion 。它没有显示'mfxvideo.h'中其他函数的错误。



  #include     mfxvideo.h 
#include < stdio.h >

// 请参阅* \ IntelTWTools\Intel(R)_Media_SDK_2016.0.2 \ doc
// 该计划仅用于教育目的。在撰写本文时,作者正在学习...
// 使用过的API 。
// 基于**英特尔媒体SDK **


int main(){
// < span class =code-comment>这里使用的API版本是针对软件和硬件版本定义的

mfxVersion SWversion = { 0 1 },版本,HWversion = { 0 1 };

// 初始化会话。应该对使用此API编写的所有程序执行此操作
mfxSession SWsession,HWsession;

// 用于监控程序的进度并分析错误(如果有的话)。
// 根据进度,我们决定推进代码的最佳路径(通过实践...
// ...这将变得更加清晰)
mfxStatus sts;

// 使用我们初始化SDK会话设置'sts'的值
// 采用以下参数(所需的实现[这里我们选择了软件] ......
// ...,所需版本的指针,所需会话的指针)
sts = MFXInit(MFX_IMPL_SOFTWARE,& SWversion,& SWsession);

// 现在使用'sts;我们检查错误。如前所述,基于sts的值...
// ...我们允许我们的程序选择最佳的继续路径
// 表示没有错误通过变量'sts'观察
如果(MFX_ERR_NONE == sts)
{
// 找出给定会话的SDK的实现版本
MFXQueryVersion(SWsession,& version);
printf( SW版本:%d。%d \ n API级别:%d。%d \ n
SWversion.Major,SWversion.Minor,version.Major,version.Minor);
}

// 重复上述基于硬件的implpementation的过程

sts = MFXInit(MFX_IMPL_HARDWARE,& HWversion,& HWsession);

if (MFX_ERR_NONE == sts)
{
MFXQueryVersion(HWsession,& version);
printf( HW版本:%d。%d \ n API级别:%d。%d \ n
HWversion.Major,HWversion.Minor,version.Major,version.Minor);
}

MFXClose(SWsession);
MFXClose(HWsession);

return 0 ;
}





我的尝试:



1 - 我已将项目链接到

解决方案>右键单击>属性> a),和b)

a)C / C + +>一般>其他包含目录> * \ IntertSWTools \英特尔%28R%29_Media_SDK_2016.0.2 \ include;%(AdditionalIncludeDirectories)

b)链接器>通用>附加库目录> * \ IntelSWTools\Intel%28R%29_Media_SDK_2016.0.2\lib;%(AdditionalLibraryDirectories)

2- Visual Studio 2017RC文档网页

3 - 在不同版本的Visual Studio上执行该程序(即2012 )和Code :: Blocks 13.12(在Code :: Blocks中编译器无法识别上述函数)

解决方案

因此在VS2015中尝试完全相同的事情并查看是否工作。

如果确实如此,那么将问题报告给MS,这样他们就可以在发布前修复它。

如果没有,那么你可能已经忘记了链接一个库或类似的。

无论如何,我们可能不是你需要交谈的人。


添加legacy_stdio_definitions.lib然后确定。

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'.

#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)

解决方案

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.


add legacy_stdio_definitions.lib then ok.


这篇关于使用visual studio 2017RC时出现LNK2019错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆