我是一名開始編程的學生。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