什么是 LNK2001 未解析的外部符号 __imp___strdup? [英] What is LNK2001 unresolved external symbol __imp___strdup?

查看:38
本文介绍了什么是 LNK2001 未解析的外部符号 __imp___strdup?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Visual Studio 2015 中将一个类从一个项目移动到另一个项目,这是我得到的错误.我找不到此特定错误的任何其他示例.

I am moving a class from one project to another in Visual Studio 2015 and this is the error that I get. I cannot find any other examples of this specific error.

推荐答案

__imp___declspec(dllimport),下一个下划线表示函数是 extern "C"__cdecl,保留 _strdup 作为函数名.因此,通过评论中链接的 MSDN 文档,符号 __imp___strdup 是:

__imp_ is __declspec(dllimport), and the next underscore indicates that the function is extern "C" and __cdecl, leaving _strdup as the function name. Therefore, going by the MSDN documentation linked in the comments, the symbol __imp___strdup is:

extern "C" __declspec(dllimport) char* __cdecl _strdup(const char* strSource);

这个函数需要头文件

由于某种原因,您将类移入的项目似乎没有使用包含该函数的 MS 库之一.至少这是我的猜测.尝试检查每个项目的属性并查看它们是否使用相同的 .lib 文件?

It would appear that the project you moved your class into doesn't use one of the MS libraries that contains the function, for some reason. That's my guess, at least. Try checking each project's properties and seeing if they use the same .lib files?

这篇关于什么是 LNK2001 未解析的外部符号 __imp___strdup?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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