最近在VSCode上跑C++代码,当编译的时候出现了题目中的问题,在CSDN上搜到的解决方案可谓是“天下一大抄”,这抄那里,那抄这里,全都一样,而且没有解释明白这个报错是什么意思,光说了一些出现该提醒可能的原因(且提到的原因我感觉驴唇不对马嘴)。所以逼得我去科学上网,用Google搜索了一下,结果第一个回答就解决了疑惑。下面分享给没法科学上网的朋友们。

简单来说,collect2 error ld returned 1 exit status提示出现之前,一般在上面几行都会有其他报错,而collect2 error ld returned 1 exit status所反映的只是其之前一共出现了多少个错误,真正的错误是在其上面出现的那些报错。比如,没有错误,会提示collect2 error ld returned 0 exit status;有两个报错,会提示collect2 error ld returned 2 exit status。所以,真正要解决的是在collect2 error ld returned 1 exit status提示出现之前的那些报错提醒。

以下是Google回答的原文:

The ld returned 1 exit status error is the consequence of your previous errors as in your example there is an earlier error - undefined reference to 'clrscr' - and this is the real one. The exit status error just signals that the linking step in the build process encountered some errors. Normally exit status 0 means success, and exit status > 0 means errors. Various tools may be running while creating a program as separate steps to create the final executable. In your case one of those tools is ld, which first reports the error it found (clrscr reference missing), and then it returns the exit status. Since the exit status is > 0, it means an error and is reported.

In many cases tools return as the exit status the number of errors they encountered. So if the old tool finds two errors, its exit status would be 2.

原回答的链接:(需科学上网)What does collect2 error ld returned 1 exit status mean | Edureka Community

(已解决)报错:collect2 error ld returned 1 exit status相关推荐

  1. Qt报错:cannot find -lws_32 collect2: error: ld returned 1 exit status

    Qt报错:cannot find -lws_32 collect2: error: ld returned 1 exit status cannot find -lws_32 报错图所示 尝试奇奇怪怪 ...

  2. 编译报错file format not recognized和collect2: error: ld returned 1 exit status记录

    报错啦! 年少无知不懂事,在编译多文件的时候使用了*来编译所有文件 ,于是报了这个错 ld: cannot find res: file format not recognized collect2: ...

  3. 解决 编译错误 对‘sem_init’未定义的引用 collect2: error: ld returned 1 exit status builtin: recipe for

    执行 $ make (gcc -Wall -g -O0 -c p*v.c) (gcc -lpthread p*v.o c*p.o -o p*v) 报错如下 p*v.o:在函数'init'中: /med ...

  4. 问题记录vips.h:133: undefined reference to `vips_reduce‘ collect2: error: ld returned 1 exit status

    @[TOC]背景 ubuntu下go build 出错: # github.com/h2non/bimg /tmp/go-build2910330990/b131/_x005.o: In functi ...

  5. Qt error: collect2: error: ld returned 1 exit status

    Ubuntu安装好Qt5.10.0后,新建最简单的项目测试环境是否OK时,出现"error: collect2: error: ld returned 1 exit status" ...

  6. gcc报(.text+0x24): undefined reference to `main‘collect2: error: ld returned 1 exit status解决方法

    我已经记不清自己为什么这样解决了,重新搜索了一下也没发现类似的答案. 由于实验需要,我需要编译这个例子: https://github.com/grimm-co/GEARSHIFT/blob/trun ...

  7. collect2: error: ld returned 1 exit status编译错误

    1.问题描述 在Linux下进行多文件(oneWay_List.c LinkList.c LinkList.h)编译时 gcc -v 版本太旧了 gcc version 4.8.5 20150623 ...

  8. :-1: error: collect2: error: ld returned 1 exit status

    这个错误通常是在编译和链接代码时出现的.它的意思是连接器在链接代码时遇到了错误,并且返回了退出状态1. 这个错误可能由多种原因引起,例如缺少库.语法错误或者链接器无法找到程序的入口点.要解决这个问题, ...

  9. NS2:undefined reference to `xxx' collect2: error: ld returned 1 exit status

    这个问题是没有链接. 刚开始先确认,头文件有没有导入. 以下是完整的提示信息错误,检查之后发现hdr_ant_pkt所在的头文件已经被导入: In function `hdr_ant_pkt::acc ...

  10. collect2.exe: error: ld returned 1 exit status分析与解决

    阅读前请看一下:我是一个热衷于记录的人,每次写博客会反复研读,尽量不断提升博客质量.文章设置为仅粉丝可见,是因为写博客确实花了不少精力.希望互相进步谢谢!! 文章目录 阅读前请看一下:我是一个热衷于记 ...

最新文章

  1. spring定时任务重复执行2次问题的解决
  2. python3.7安装numpy库_python2.7/3.7安装NumPy函数库的一种方法及小心得
  3. 仿 小米运动_小米有品上架“黑科技”床垫,让你睡在“空气”上,改变睡眠体验...
  4. red hat enterprise linux 7关闭防火墙的方法
  5. 聊聊有哪些参与项目的好途径吧
  6. 浏览器兼容性问题解决方案之CSS——已在IE、FF、Chrome测试
  7. mysql transaction 实践小问题
  8. JavaScript高级程序设计(第3版).pdf
  9. Qt5调用Snap7
  10. mac本常用快捷键大全
  11. 软件分享,PicPick中文版 v5.1.4 滚动截图
  12. 蜻蜓和蝉c语言,趣味数学:蜻蜓、蜘蛛、蝉它们的翅膀和腿
  13. 三星,现代,中颖,合泰,松翰等单片机定时器溢出计算公式
  14. 面试技巧顶个P --leo谈应届生求职 2
  15. Ping值和带宽之间关系
  16. cf 830 D1. Balance (Easy version)
  17. AI溃败,被Dota2职业战队打蠢!独家专访OpenAI:我们发现一个Bug
  18. 解决警告You are running the esm-bundler build of vue-i18n. It is recommended to configure your bundler
  19. JQuery实现笼罩层
  20. 山东理工大学计算机考研究生分数线,山东理工大学2021考研分数线已公布

热门文章

  1. 异星工厂服务器无响应,异星工厂无法联机解决方法 异星工厂无法联机怎么办...
  2. 学习天才犹太人的经商法则
  3. Android获取SystemProperties方法
  4. 高项、高级项目管理师论文-质量管理
  5. operator int()用法
  6. 反激电源电路电磁干扰原理
  7. linux下搭建L2TP+IPSec服务端,组建异地虚拟局域网
  8. react.js 原生文字下划线标注功能开发
  9. 弹性布局和AndroidAutoSize屏幕适配
  10. 3ds Max Taper、Twist和Bend的运用——衣架的制作