[英]How do I fix a clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am trying to learn c++ but I cannot run a basic HelloWorld program.我正在尝试学习 c++ 但我无法运行基本的 HelloWorld 程序。
Im am receiving an error saying 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)我收到一条错误消息,指出体系结构 x86_64 的未定义符号:“_main”,引用自:主可执行文件的隐式条目/启动 ld:未找到体系结构 x86_64 的符号 clang:错误:linker 命令失败,退出代码为 1(使用-v 查看调用)
This is the code.这是代码。
#include <iostream>
int main() {
std::cout << "Hello World";
return 0;
}
Nihal, If you are doing this work for a course, you should search/ask for instructions on how to successfully install the required environment. Nihal,如果您正在为课程做这项工作,您应该搜索/询问有关如何成功安装所需环境的说明。
If you are self-teaching, you might consider starting with an environment like repl.it ( https://repl.it/ ).如果您是自学,您可以考虑从像 repl.it ( https://repl.it/ ) 这样的环境开始。 It's online, it's free, and if you ask it to create a C++ project for you, you will have everything you need to start with.它是在线的,它是免费的,如果你要求它为你创建一个 C++ 项目,你将拥有开始所需的一切。
I use repl.it to teach my college-level C++ course.我使用 repl.it 来教授我的大学水平 C++ 课程。 It works well for all the basic stuff, including file I/O.它适用于所有基本的东西,包括文件 I/O。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.