求助啊,VS2013运行 Error LNK2001 Error LNK2019

tank2651094 2016-10-07 05:21:15
求助啊,小菜鸡一个见谅,对环境配置不太熟悉,百度了半天找了也找不出问题。有一段时间没用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 中被引用
...全文
480 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
tank2651094 2016-10-09
  • 打赏
  • 举报
回复
折腾了几天,百度 csdn msdn都找不到解决办法,配置重置都不行,无奈只能完全卸载重装了。终于好了。
赵4老师 2016-10-08
  • 打赏
  • 举报
回复
将错误信息中出现的标识符放在百度里面搜一下,看其在哪个.lib中,然后在本地硬盘上搜索该.lib,如果没有,在网上搜索相关库或模块下载安装,然后将其所在目录填写到“附加依赖库所在目录”中,将其名字添加到“附加依赖库”中,重新连接。 VC6: 工程、设置、C/C++、分类:Preprocessor、附加包含路径:填写附加头文件所在目录 逗号间隔多项 工程、设置、Link、分类:Input、附加库路径:填写附加依赖库所在目录 分号间隔多项 工程、设置、Link、分类:Input、对象/库模块:填写附加依赖库的名字.lib 空格间隔多项 VS20xx: 项目、属性、C/C++、附加包含目录:填写附加头文件所在目录 分号间隔多项 项目、属性、链接器、常规、附加库目录:填写附加依赖库所在目录 分号间隔多项 项目、属性、链接器、输入、附加依赖项:填写附加依赖库的名字.lib 空格或分号间隔多项
tank2651094 2016-10-07
  • 打赏
  • 举报
回复
引用 5 楼 u010909114 的回复:
[quote=引用 4 楼 tank2651094 的回复:] [quote=引用 2 楼 u010909114 的回复:] 1:可在同事电脑写个能够正常运行的,然后拿到自己电脑上试试呗,这样可排除是代码的问题还是开发环境的问题? 2:有时问题一种思路行不通,可换下试试。
写个很简单的打印helloworld都运行不起来。运行以前的学习的例子是出现同样的问题,所以我觉得应该是环境配置问题。在家自学的。。。实在找不出办法,只能上论坛求助了[/quote] 当前也是初学C++ ,不懂,但帮顶。[/quote]多谢!
花开花折 2016-10-07
  • 打赏
  • 举报
回复
引用 4 楼 tank2651094 的回复:
[quote=引用 2 楼 u010909114 的回复:] 1:可在同事电脑写个能够正常运行的,然后拿到自己电脑上试试呗,这样可排除是代码的问题还是开发环境的问题? 2:有时问题一种思路行不通,可换下试试。
写个很简单的打印helloworld都运行不起来。运行以前的学习的例子是出现同样的问题,所以我觉得应该是环境配置问题。在家自学的。。。实在找不出办法,只能上论坛求助了[/quote] 当前也是初学C++ ,不懂,但帮顶。
tank2651094 2016-10-07
  • 打赏
  • 举报
回复
引用 2 楼 u010909114 的回复:
1:可在同事电脑写个能够正常运行的,然后拿到自己电脑上试试呗,这样可排除是代码的问题还是开发环境的问题? 2:有时问题一种思路行不通,可换下试试。
写个很简单的打印helloworld都运行不起来。运行以前的学习的例子是出现同样的问题,所以我觉得应该是环境配置问题。在家自学的。。。实在找不出办法,只能上论坛求助了
tank2651094 2016-10-07
  • 打赏
  • 举报
回复
引用 1 楼 paschen 的回复:
需要将依赖的库文件添加到项目设置中。 具体位置在:项目属性——链接器——输入——附加依赖项
百度找了很多问题也说是需要将依赖的库文件添加到项目设置,但是附加依赖项一直都是默认的:从父级或项目默认设置继承。 以前都没问题的。现在只是写个简单的打印helloword都不能运行。我也不知道要加什么库。。。 在配置—C/C++—代码生成—运行库—MT MTd MD MDd每一个试过也都不行。
花开花折 2016-10-07
  • 打赏
  • 举报
回复
1:可在同事电脑写个能够正常运行的,然后拿到自己电脑上试试呗,这样可排除是代码的问题还是开发环境的问题? 2:有时问题一种思路行不通,可换下试试。
paschen 2016-10-07
  • 打赏
  • 举报
回复
需要将依赖的库文件添加到项目设置中。 具体位置在:项目属性——链接器——输入——附加依赖项

69,382

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧