求帮助啊,VS2013运行 Error LNK2001 Error LNK2019

C语言 码拜 7年前 (2017-04-22) 2170次浏览
求帮助啊,小菜鸡一个见谅,对环境配置不太熟悉,百度了半天找了也找不出问题。有一段时间没用VS了,以前用着没问题,现在用C和C++写个最简单helloworld都运行不起来,cocos2d-x-2.2.3引擎却可以正常运行。好像是后来安装了qt-opensource-windows-x86-msvc2013_64-5.7.0之后才出现的问题,不知道是不是QT改了什么设置。浪费了一天时间在这问题上了。

#include <stdio.h>
int main()
{
	printf("hello world");
	return 0;
}

1>MSVCRTD.lib(crtexe.obj) : error LNK2019: 无法解析的外部符号 __imp__EncodePointer@4,该符号在函数 _pre_c_init 中被引用
1>MSVCRTD.lib(atonexit.obj) : error LNK2001: 无法解析的外部符号 __imp__EncodePointer@4
1>MSVCRTD.lib(error.obj) : error LNK2019: 无法解析的外部符号 __imp__IsDebuggerPresent@0,该符号在函数 “void __cdecl failwithmessage(void *,int,int,char const *)” (?failwithmessage@@YAXPAXHHPBD@Z) 中被引用
1>MSVCRTD.lib(gs_report.obj) : error LNK2001: 无法解析的外部符号 __imp__IsDebuggerPresent@0
1>MSVCRTD.lib(error.obj) : error LNK2019: 无法解析的外部符号 __imp__RaiseException@16,该符号在函数 “int __cdecl DebuggerProbe(unsigned long)” (?DebuggerProbe@@YAHK@Z) 中被引用
1>MSVCRTD.lib(error.obj) : error LNK2019: 无法解析的外部符号 __imp__GetLastError@0,该符号在函数 “void __cdecl _RTC_AllocaFailure(void *,struct _RTC_ALLOCA_NODE *,int)” (?_RTC_AllocaFailure@@YAXPAXPAU_RTC_ALLOCA_NODE@@H@Z) 中被引用
1>MSVCRTD.lib(pdblkup.obj) : error LNK2001: 无法解析的外部符号 __imp__GetLastError@0
1>MSVCRTD.lib(error.obj) : error LNK2019: 无法解析的外部符号 __imp__GetProcAddress@8,该符号在函数 “void __cdecl _RTC_AllocaFailure(void *,struct _RTC_ALLOCA_NODE *,int)” (?_RTC_AllocaFailure@@YAXPAXPAU_RTC_ALLOCA_NODE@@H@Z) 中被引用
1>MSVCRTD.lib(pdblkup.obj) : error LNK2001: 无法解析的外部符号 __imp__GetProcAddress@8
1>MSVCRTD.lib(error.obj) : error LNK2019: 无法解析的外部符号 __imp__LoadLibraryExW@12,该符号在函数 “void __cdecl _RTC_AllocaFailure(void *,struct _RTC_ALLOCA_NODE *,int)” (?_RTC_AllocaFailure@@YAXPAXPAU_RTC_ALLOCA_NODE@@H@Z) 中被引用
1>MSVCRTD.lib(pdblkup.obj) : error LNK2001: 无法解析的外部符号 __imp__LoadLibraryExW@12
1>MSVCRTD.lib(error.obj) : error LNK2019: 无法解析的外部符号 __imp__MultiByteToWideChar@24,该符号在函数 “void __cdecl failwithmessage(void *,int,int,char const *)” (?failwithmessage@@YAXPAXHHPBD@Z) 中被引用
1>MSVCRTD.lib(error.obj) : error LNK2019: 无法解析的外部符号 __imp__WideCharToMultiByte@32,该符号在函数 “void __cdecl failwithmessage(void *,int,int,char const *)” (?failwithmessage@@YAXPAXHHPBD@Z) 中被引用
1>MSVCRTD.lib(gs_support.obj) : error LNK2019: 无法解析的外部符号 __imp__QueryPerformanceCounter@4,该符号在函数 ___security_init_cookie 中被引用
1>MSVCRTD.lib(gs_support.obj) : error LNK2019: 无法解析的外部符号 __imp__GetCurrentProcessId@0,该符号在函数 ___security_init_cookie 中被引用
1>MSVCRTD.lib(gs_support.obj) : error LNK2019: 无法解析的外部符号 __imp__GetCurrentThreadId@0,该符号在函数 ___security_init_cookie 中被引用
1>MSVCRTD.lib(gs_support.obj) : error LNK2019: 无法解析的外部符号 __imp__GetSystemTimeAsFileTime@4,该符号在函数 ___security_init_cookie 中被引用
1>MSVCRTD.lib(atonexit.obj) : error LNK2019: 无法解析的外部符号 __imp__DecodePointer@4,该符号在函数 __onexit 中被引用
1>MSVCRTD.lib(pdblkup.obj) : error LNK2019: 无法解析的外部符号 __imp__HeapAlloc@12,该符号在函数 “int __cdecl _RTC_GetSrcLine(unsigned char *,wchar_t *,unsigned long,int *,wchar_t *,unsigned long)” (?_RTC_GetSrcLine@@YAHPAEPA_WKPAH1K@Z) 中被引用
1>MSVCRTD.lib(pdblkup.obj) : error LNK2019: 无法解析的外部符号 __imp__HeapFree@12,该符号在函数 “int __cdecl _RTC_GetSrcLine(unsigned char *,wchar_t *,unsigned long,int *,wchar_t *,unsigned long)” (?_RTC_GetSrcLine@@YAHPAEPA_WKPAH1K@Z) 中被引用
1>MSVCRTD.lib(pdblkup.obj) : error LNK2019: 无法解析的外部符号 __imp__GetProcessHeap@0,该符号在函数 “int __cdecl _RTC_GetSrcLine(unsigned char *,wchar_t *,unsigned long,int *,wchar_t *,unsigned long)” (?_RTC_GetSrcLine@@YAHPAEPA_WKPAH1K@Z) 中被引用
1>MSVCRTD.lib(pdblkup.obj) : error LNK2019: 无法解析的外部符号 __imp__VirtualQuery@12,该符号在函数 “int __cdecl _RTC_GetSrcLine(unsigned char *,wchar_t *,unsigned long,int *,wchar_t *,unsigned long)” (?_RTC_GetSrcLine@@YAHPAEPA_WKPAH1K@Z) 中被引用
1>MSVCRTD.lib(pdblkup.obj) : error LNK2019: 无法解析的外部符号 __imp__FreeLibrary@4,该符号在函数 “struct HINSTANCE__ * __cdecl GetPdbDllFromInstallPath(void)” (?GetPdbDllFromInstallPath@@YAPAUHINSTANCE__@@XZ) 中被引用
1>MSVCRTD.lib(pdblkup.obj) : error LNK2019: 无法解析的外部符号 __imp__GetModuleFileNameW@12,该符号在函数 “struct HINSTANCE__ * __cdecl GetPdbDll(void)” (?GetPdbDll@@YAPAUHINSTANCE__@@XZ) 中被引用
1>MSVCRTD.lib(pdblkup.obj) : error LNK2019: 无法解析的外部符号 __imp__GetModuleHandleW@4,该符号在函数 “struct HINSTANCE__ * __cdecl GetPdbDll(void)” (?GetPdbDll@@YAPAUHINSTANCE__@@XZ) 中被引用
1>MSVCRTD.lib(gs_report.obj) : error LNK2019: 无法解析的外部符号 _IsProcessorFeaturePresent@4,该符号在函数 ___report_gsfailure 中被引用

解决方案

20

需要将依赖的库文件添加到项目设置中。
具体位置在:项目属性——链接器——输入——附加依赖项

5

1:可在同事电脑写个能够正常运行的,然后拿到本人电脑上试试呗,这样可排除是代码的问题还是开发环境的问题?
2:有时问题一种思路行不通,可换下试试。

25

将错误信息中出现的标识符放在百度里面搜一下,看其在哪个.lib中,然后在本地硬盘上搜索该.lib,假如没有,在网上搜索相关库或模块下载安装,然后将其所在目录填写到“附加依赖库所在目录”中,将其名字添加到“附加依赖库”中,重新连接。
VC6:
工程、设置、C/C++、分类:Preprocessor、附加包含路径:填写附加头文件所在目录 逗号间隔多项
工程、设置、Link、分类:Input、附加库路径:填写附加依赖库所在目录 分号间隔多项
工程、设置、Link、分类:Input、对象/库模块:填写附加依赖库的名字.lib 空格间隔多项
VS20xx:
项目、属性、C/C++、附加包含目录:填写附加头文件所在目录 分号间隔多项
项目、属性、链接器、常规、附加库目录:填写附加依赖库所在目录 分号间隔多项
项目、属性、链接器、输入、附加依赖项:填写附加依赖库的名字.lib 空格或分号间隔多项

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明求帮助啊,VS2013运行 Error LNK2001 Error LNK2019
喜欢 (0)
[1034331897@qq.com]
分享 (0)