Qt mingw:file not recognized: File truncated collect2.exe:-1: error: error: ld returned 1 exit statu

问题现象:

一般会提示某个.o文件无法识别,出现这种现象的原因通常是编译时异常退出等导致的文件不完整。

解决方法:

clean 之后生成或直接rebuild即可

collect2.exe 参考自stackoverflow

collect2 is a utility used to generate a table of constructors that __main (an auto-generated function called at the beginning of main) depends on. Normally you don’t see it because it’s named ld on the file system, and it in turn calls the real ld (typically called real-ld, although collect2 will check a number of places looking for it)

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在使用VS Code和MinGW进行C语言编译时,你遇到了"collect2.exe: error: ld returned 1 exit status"错误。这个错误通常表示链接过程中出现了问题。有几个可能的解决方法可以尝试: 1. 检查代码:请确保你的代码没有关键字拼写错误或其他语法错误。这些错误可能会导致链接失败。 2. 关闭collect2.exe进程:按下Win+R,输入msinfo32并按Enter。在打开的窗口中选择"软件环境",然后找到正在运行的任务。找到与collect2.exe相关的进程,并查看其"进程ID"。然后再次按下Win+R,输入cmd并按Enter。在命令提示符中输入"tskill 进程ID"来关闭进程。 3. 保存并重新运行:按下Ctrl+S保存你的代码,并重新运行编译过程。 如果上述方法都没有解决问题,你可以参考之前写的关于"undefined reference to __imp_WSAStartup"错误的文章中的解决方法,可能会对你有所帮助。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [collect2.exe: error: ld returned 1 exit status 解决方法](https://blog.csdn.net/qq_34928811/article/details/119337195)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [VSCode 编写 C++ 运行时出现”collect2.exeerrorld returned 1 exit status&ldquo;问题的相关解决方法](https://blog.csdn.net/liu_feng_zi_/article/details/102489769)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [collect2.exe: error: ld returned 1 exit status分析与解决](https://blog.csdn.net/qq_40967086/article/details/128492142)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值