简体   繁体   English

如何修复 clang:错误:linker 命令失败,退出代码为 1(使用 -v 查看调用)

[英]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.

相关问题 如何解决错误:链接器命令失败,退出代码为1(使用-v查看调用)? - How to fix error: linker command failed with exit code 1 (use -v to see invocation)? clang:错误:在cmake中链接库时,链接器命令失败,退出代码为1(使用-v查看调用) - clang: error: linker command failed with exit code 1 (use -v to see invocation) when linking library in cmake 铛:错误:链接器命令失败,退出代码为1(使用-v查看调用)*关于全局变量 - clang: error: linker command failed with exit code 1 (use -v to see invocation) *about global variables VSCode:clang:错误:linker 命令失败,退出代码为 1(使用 -v 查看调用) - VSCode: clang: error: linker command failed with exit code 1 (use -v to see invocation) clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)控制台应用程序 - clang: error: linker command failed with exit code 1 (use -v to see invocation) console app 铛:错误:链接器命令失败,退出代码为1(使用-v查看调用)MINIX3 - clang: error: linker command failed with exit code 1 (use -v to see invocation) MINIX3 铛:错误:链接器命令失败,退出代码为1(使用-v查看调用)-Qt Creator 3.3 - clang: error: linker command failed with exit code 1 (use -v to see invocation) - Qt Creator 3.3 编译我的 C++ 程序:clang: error: linker command failed with exit code 1(使用 -v 查看调用) - Compiling my c++ program: clang: error: linker command failed with exit code 1 (use -v to see invocation) Cocos2d-x-铛:错误:链接器命令失败,退出代码为1(使用-v查看调用) - Cocos2d-x - clang: error: linker command failed with exit code 1 (use -v to see invocation) clang++:错误:linker 命令在带有 ffmpeg 的 cpp 中失败,退出代码为 1(使用 -v 查看调用) - clang++: error: linker command failed with exit code 1 (use -v to see invocation) in cpp with ffmpeg
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM