编译错误:链接器命令失败,退出代码为 1
Compile Error: linker command failed with exit code 1
我是C++新手,并试图制作一个简单的程序。
但是我收到此错误:
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)
[Finished in 0.4s with exit code 1]
从此代码:
#include <iostream>
using namespace std;
// Lets add some global variables
int FirstNumber = 0;
int SecondNumber = 0;
int MultiNum = 0;
void MultiNumbers ()
{
cout << "Enter the first number: ";
cin >> FirstNumber;
cout << "Enter the second number: ";
cin >> SecondNumber;
// Multiply two numbers...
MultiNum = FirstNumber * SecondNumber;
// Display result
cout << "Displaying result from MultiNumbers(): ";
cout << FirstNumber << " x " << SecondNumber;
cout << " = " << MultiNum << endl;
}
int Main ()
{
cout << "This program will help you to multiply two numbers" << endl;
// Now call the function that does all the work
MultiNumbers();
cout << "Displaying from main(): ";
// This line will not compile and work because of the global variables
cout << FirstNumber << " x " << SecondNumber;
cout << " = " << MultiNum << endl;
return 0;
}
我尝试在崇高上检查我的编译器,使用 g++ -o 测试测试在终端中编译.cpp
但似乎没有任何帮助。
我的理解是,我已经在上面定义了MultiNumbers(),然后我在Main()中调用它...但我似乎错过了一些东西...
建议?
C++区分
大小写。这:
int Main ()
应该是
int main ()
相关文章:
- pclose() 不会给我进程退出代码
- Netbeans 10:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)
- 链接器命令失败,macOS 上的退出代码为 1(使用 -v 查看调用)
- 为什么我的 c++ 代码在使用堆栈时以退出代码 11 结尾?
- 使用常量字符*时退出代码 139
- 程序显示以退出代码 0; 结束
- VSCode C++终端进程已终止,退出代码为:1
- CMake 错误:链接器命令失败,退出代码为 1 和 cpp.o 文件
- clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用) - 体系结构的未定义符号 x86_64:
- 如何修复 clang: 错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)
- CLion、MinGW 和 SDL2:进程已完成,退出代码为 -1073741515 (0xC0000135)
- 运行Qt时处理退出代码0xC0000135 hello world
- 获取加速::p rocess::子的退出代码 在提升::asio::io_service?
- Xcode:链接器命令失败,退出代码为 1(使用 -v 查看调用)[C++]
- 重载 <= 运算符,但程序以退出代码 -1073741571 (0xC00000FD) 结尾
- Android NDK.Build命令失败.未定义的引用.clang++:错误:链接器命令失败,退出代码为1
- 终端进程终止,退出代码为:1有什么方法可以修复它吗
- 运行自定义可执行文件,QProcess 立即退出,退出代码为 1
- 错误:链接器命令失败,退出代码为 1(使用 -v 查看调用):在 Macbook 上
- C++ XCODE ld:找不到体系结构x86_64 clang 的符号:错误:链接器命令失败,退出代码为 1(使用 -