/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o: In function `_start': (.text+0x20): undefined reference to `main' collect2: error: ld returned 1 exit status

原因:
要编译的c程序test.c可能是“只读型文件”,既不能写,也不能执行,之前对它的写入的程序实际上并没有保存,所以会报main()找不到这个错误
解决办法:
修改test.c的权限(chmod 777 test.c),重新写入程序,再次编译(g++ -c test.c)和生成可执行文件(g++ -o test test.o),最后运行test这个文件(./test),运行成功

相关文章:

  • 2021-06-20
  • 2021-04-07
  • 2021-07-31
  • 2022-12-23
  • 2023-03-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-25
  • 2021-07-23
  • 2021-10-07
  • 2021-05-24
  • 2021-12-22
  • 2022-12-23
  • 2021-03-30
相关资源
相似解决方案