解决Visual Studio编译运行时出现“error MSB6006: link.exe 已退出,代码为 2“错误的方法

       平常的学习时我都是用的codeblocks来写代码,之前去一家公司面试时他们给的编译器的VS,完全没用过VS的我一脸懵逼,不知道软件怎么用。(之所以自己写代码不用VS的原因是VS的全家桶太大,一运行起来就卡的要死,电脑不够强大,只好用codeblocks了)。

        为了不再继续吃这种亏,我就去装了个VS2019,装好之后写个helloworld,居然运行不了,显示着系统找不到指定文件之类的错误,还有这个"error MSB6006: link.exe 已退出,代码为 2",我就去网上找了各种方法来试,什么重新加载解决方案啊,添加SDK组件啊,删除安装路径下的文件,重启软件之类的种种方法都试过了,都没用,折腾了一个早上。最后还是在一个渣浪的博客里面找到了解决方法,就是把所有的安全软件、防火墙都关掉。PS:我当时开着一个拦截弹窗的软件,关闭了之后,VS就可以正常编译运行了。大功告成。

1>xt_lib_uf.lib(xt_windows.obj) : warning LNK4099: 未找到 PDB“xt_lib_uf.pdb”(使用“xt_lib_uf.lib(xt_windows.obj)”或在“F:\code\CncAutoDrlHole\find_std_xuti_subtract\find_std_xuti_subtract\x64\NX12\xt_lib_uf.pdb”中寻找);正在链接对象,如同没有调试信息一样 1>find_std_xuti_subtract.vcxproj -> F:\code\CncAutoDrlHole\find_std_xuti_subtract\find_std_xuti_subtract\x64\NX12\find_std_xuti_subtract.dll 1>find_std_xuti_subtract.vcxproj -> F:\code\CncAutoDrlHole\find_std_xuti_subtract\find_std_xuti_subtract\x64\NX12\find_std_xuti_subtract.pdb (Full PDB) 1>The MSVCDir environment variable is not defined 1>This variable is necessary only when using uflink or starting up Studio 1>from this window. You must modify the ufvars.bat file to define this. 1>Error signing application, F:\code\CncAutoDrlHole\find_std_xuti_subtract\find_std_xuti_subtract\x64\NX12\find_std_xuti_subtract.dll. 1> Application has not been compiled with NXSigningResource.cpp. 1>Checking for the presence of c_p_p_author license. 1>Signing files... 1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(133,5): error MSB3073: 命令“call "E:\UG\NX12.0\ugii\ugiicmd.bat" "E:\UG\NX12.0" 1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(133,5): error MSB3073: "E:\UG\NX12.0\NXBIN\signcpp.exe" "F:\code\CncAutoDrlHole\find_std_xuti_subtract\find_std_xuti_subtract\x64\NX12\find_std_xuti_subtract.dll" 1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(133,5): error MSB3073: :VCEnd”已退出代码为 -1。 1>已完成生成项目“find_std_xuti_subtract.vcxproj”的操作 - 失败。
最新发布
03-19
评论 13
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值