首页 > 其他分享 >collect2 error ld returned 1 exit status

collect2 error ld returned 1 exit status

时间:2023-02-21 18:13:47浏览次数:31  
标签:status ld returned exit error collect2

最近在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.
————————————————
版权声明:本文为CSDN博主「间歇努力为了持续躺平」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_45055622/article/details/126634000

标签:status,ld,returned,exit,error,collect2
From: https://www.cnblogs.com/begoogatprogram/p/17141913.html

相关文章

  • 给UITableViewCell添加UITextField
     UITextField*textField=[[UITextFieldalloc]initWithFrame:CGRectMake(90,12,200,25)];textField.clearsOnBeginEditing=NO;//鼠标点上时,不清空......
  • 一张图看懂CodeArts Build 6大特性,带你玩转构建服务
    华为云编译构建服务CodeArtsBuild为开发者提供配置简单的混合语言构建平台,实现编译构建云端化,支撑企业实现持续交付,缩短交付周期,提升交付效率。CodeArtsBuild支持编译构建......
  • 测试平台系列(3) 给Hello World添加日志
    给HelloWorld添加日志回顾通过上篇内容,我们已经使用Flask完成了我们的第一个接口。我们可以看到,使用Flask来编写接口是十分简单的。那么接下来,我们丰富一下上面的例子......
  • 0x02_My-OS操作系统里的helloworld
      直接看目录结构│main.c(可以调用asm的函数,可以使用最原始的c语言,你要明白基本所有头文件都要用汇编自己造)│Makefile(make脚本)├─asm│asmhead.asm(别......
  • uni-app api:获取网络类型(hbuilderx 3.6.18)
    一,代码:<template><view><button@click="getNetwork">得到网络类型</button></view></template><script>exportdefault{data(){......
  • 规则LDPC和不规则LDPC译码算法MATLAB仿真
    up目录一、理论基础二、核心程序三、测试结果一、理论基础LDPC码是根据低密度稀疏校验矩阵H来构造的。假设需要发送一组信息T{t_1,t_2,⋯,t_n},在发送前先使用生成矩......
  • Date和LocalDateTime相互转换
    Datein=newDate();LocalDateTimeldt=LocalDateTime.ofInstant(in.toInstant(),ZoneId.systemDefault());Dateout=Date.from(ldt.atZone(ZoneId.systemDefaul......
  • 滑动silder切换图片,向上弹出设置层
     ////HelloWorldViewController.h//图片浏览////Createdbymahongminon14-5-15.//Copyright(c)2014年mahongmin.Allrightsreserved.//#import<UIKit/U......
  • leveldb.net区块链技术
    leveldb.net工作原理:leveldb为键值对数据库,具有增加,删除,查询功能,利用加密链式结构存储和查询数据。区块(block):在区块链技术中,数据以电子记录的形式被永久储存下来,存放这些......
  • 档案系统leveldb.net集成
    leveldb.net工作原理:leveldb为键值对数据库,具有增加,删除,查询功能,利用加密链式结构存储和查询数据。区块(block):在区块链技术中,数据以电子记录的形式被永久储存下来,存放这些......