我是一名开始编程的学生。Xcode C++错误“链接器命令失败,退出代码1”
这里我写了一个简单的“两个数字的总和”程序在Xcode中使用C++。
//preprocessor directive
#include <stdio.h>
//local declarations
int main (void)
{
//declare variables
int n1, n2, sum;
//input prompts
printf("This program finds the sum of two numbers. Enter your first number.\n");
scanf("%d" , &n1);
printf("Enter another number.\n");
scanf("%d" , &n2);
//process
sum=n1+n2;
//output
printf("The sum is %d." , sum);
return 0;
}
至于我可以告诉大家,我的语法是正确的,但是,当我尝试建立的程序,我得到这个错误代码:
“苹果的Mach-O接头(Id)的错误。链接器命令失败,退出代码1(使用-v查看调用)“
我一直无法通过阅读其他Q和A来解决此问题。
任何建议的解决方案?这将不胜感激!!
这不能是唯一的错误,在它之前必须有更多的错误。 – molbdnilo