自定义算字符串值的函数,生成可执行文件时出错,请大神指点!
#include<stdio.h>int checksum(char *a,int n);
void main()
{
char a[100];
gets(a);
puts(a);
checksum(a,100);
}
int check(char *a,int n)
{
int i=0,sum=0;
while(a[i]!='\0')
{
sum+=a[i++];
}
printf("%d",sum);
return 0;
}
下面结果
Compiling...
1_8_3.cpp
Linking...
1_8_3.obj : error LNK2001: unresolved external symbol "int __cdecl checksum(char *,int)" (?checksum@@YAHPADH@Z)
Debug/1_8_3.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.
1_8_3.exe - 1 error(s), 0 warning(s)
就指点!