[英]Why is it showing Clang error 1 on Visual Studio Code?
我从一个简单的程序开始测试我的 vscode 是否在装有 BigSur OS 的 MacBook Air 上正常运行。 代码是
#include<stdio.h>
int main()
{
printf("Hello");
return 0;
}
但是这个错误来了:
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable.
ld: symbol(s) not found for architecture x86_64.
**clang: error: linker command failed with exit code 1 (use -v to see invocation)**
我需要执行哪些步骤才能运行这段简单的代码?
首先,确保您按照本教程正确配置了 VSC。
生成和编辑任务涉及很多tasks.json
/ launch.json
文件,如果您没有正确执行,您可能会遇到问题。
如果您愿意走捷径,您总是可以安装 VS Code Runner扩展程序,它将为您解决很多麻烦,并使您能够在 Mac 上使用CTRL + OPTION + N运行代码。
考虑到您是初学者,最简单的解决方案是重新配置您的 vscode。 单击此处查看如何逐步为 C/C++ 配置 VSCode。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.