C程序编译时提示无法解析的外部命令

下面是程序代码,求大侠指点指点:
#include<stdio.h>

#define MAX 100
#define YES 1
#define NO 0

long income[MAX];
int month[MAX], day[MAX], year[MAX];
int x, y, ctr;
int cont;
long month_total, grand_total;

int main(void);
int display_instructions(void);
void get_data(void);
void display_report(void);
int continue_function(void);

int main(void)

{
cont = display_instructions();

if( cont == YES )
{
get_data();
display_report();
}
else
printf("\n\nProgram aborted by user!\n\n");

return 0;
}

int display_instructions(void)
{
printf("\n\n");
printf("\nThis program enables you to enter up to 99 people\'s");
printf("\nincomes and birthdays. It then prints the incomes by");
printf("\nmonth along with the overall income and overall average.");
printf("\n");

cont = continue_function();
return( cont );
}

void get_data(void)
{
for( cont = YES, ctr = 0; ctr < MAX && cont == YES; ctr++)
{
printf("\nEnter information for Person %d.", ctr+1);
printf("\n\tEnter birthday:");

do
{
printf("\n\tMonth (0 - 12):");
scanf("%d", &month[ctr]);
} while ( month[ctr] < 0 || month[ctr] > 12 );

do
{
printf("\n\tDay (0 - 31 ):");
scanf("%d", &day[ctr]);
} while (day[ctr] < 0 || day[ctr] > 31);

do
{
printf("\n\tYear (0 - 2002):");
scanf("%d", &year[ctr]);
} while(year[ctr] < 0 || year[ctr] > 2002);

printf("\nEnter Yearly Income (Whole dollars):");
scanf("%ld", &income[ctr]);

cont = continue_function();
}

}

void display_report()
{
grand_total = 0;
printf("\n\n\n");
printf("\n SALARY SUMMARY");
printf("\n ================");

for(x = 0; x <= 12; x++)
{
month_total = 0;

for(y = 0; y < ctr; y++)
{
if(month[y] == x)
month_total += income[y];
}
printf("\nTotal for month %d is %ld", x, month_total);
grand_total += month_total;
}
printf("\n\nReport totals:");
printf("\nTotal Income is %ld", grand_total);
printf("\nAverage Income is %ld", grand_total/ctr);

printf("\n\n* * * End of Report* * *\n");
}

int contiune_function(void)
{
printf("\n\nDo you wish to continue? (0=NO/1=YES: ");
scanf("%d", &x);

while(x < 0 || x > 1)
{
printf("\n%d is invalid!", x);
printf("\nPlease enter 0 to quit or 1 to continue: ");
scanf("%d", &x);
}

if(x == 0)
return(NO);
else
return(YES);
}

编译时提示:

1> e:\program files\microsoft visual studio 10.0\vc\include\stdio.h(304) : 参见“scanf”的声明
1>main.obj : error LNK2019: 无法解析的外部符号 "int __cdecl continue_function(void)" (?continue_function@@YAHXZ),该符号在函数 "int __cdecl display_instructions(void)" (?display_instructions@@YAHXZ) 中被引用
1>D:\c语言\week\Debug\week.exe : fatal error LNK1120: 1 个无法解析的外部命令


int contiune_function(void)
{
printf("\n\nDo you wish to continue? (0=NO/1=YES: ");
scanf("%d", &x);


这里名字写错了,应该是:continue_function

int continue_function()
{
    printf("\n\nDo you wish to continue? (0=NO/1=YES: ");
    scanf("%d", &x);

    while(x < 0 || x > 1)
    {
        printf("\n%d is invalid!", x);
        printf("\nPlease enter 0 to quit or 1 to continue: ");
        scanf("%d", &x);
    }

    if(x == 0)
        return(NO);
    else
        return(YES);
}

追问

改了还是不行啊

追答

你确定你把最后一个函数的名字改为continue_function了?我在vc6.0下可以运行的

追问

我是win7 只能用visual studio 2010 无法运行 难道是函数库的问题? 可我那是自定义函数啊 头疼

追答

visual studio 2010好像要加头文件stdafx.h

温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-10-17
声明跟定义的名字不一样contiune_function
相似回答