【发布时间】:2019-03-28 03:58:04
【问题描述】:
我正在制作一个菜单系统,用户输入一定数量的数字,系统输出平均值和总和,然后显示用户输入系统但我无法获得的数字到目前为止,我收到此错误消息“clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)”。
#include <stdio.h>
#include <stdlib.h>
#define LIMIT 1000
#define PAUSE system("pause")
//prototype functions
int getChoice();
int getNumbers(int numbers[], int eSize);
void displayAllNumbers(int array[], int eSize);
void displayAverage(int numbers[], int eSize);
void showSum(int numbers[], int eSize);
int main(){
int choice;
int numbers[LIMIT] = {0};
int eSize = 0;
do{
choice = getChoice();
switch(choice){
case 1: //get a bunch of numbers from user
eSize = getNumbers(numbers, eSize);
break;
case 2: //show the sum of the user-entered numbers
showSum( numbers, eSize);
break;
case 3: //show the average of the user-entered numbers
displayAverage(numbers, eSize);
break;
case 4: //show the numbers
displayAllNumbers(numbers , eSize);
break;
case 5: //quit the program
printf("thank you for using my program!\n");
PAUSE;
break;
default:
printf("invalid choice... please try again!\n");
PAUSE;
break;
}//end of switch
}while(choice != 5);
//end of dowhile
}//end of main```
【问题讨论】:
-
完整的错误信息是什么?
-
"_displayAllNumbers",引用自:arrayIntroLuisDuarte-9d0673.o 中的_main "_getChoice",引用自:arrayIntroLuisDuarte-9d0673.o 中的_main,引用自:arrayIntroLuisDuarte-9d0673.o 中的_main “_showSum”,引用自:arrayIntroLuisDuarte-9d0673.o ld 中的 _main:未找到架构 x86_64 clang 的符号:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)
标签: c function switch-statement