很新手的代码,为什么编译成功了,运行时link出错
本帖最后由 学习c学习u 于 2017-5-2 18:54 编辑能帮我看看错在哪吗?
--------------------Configuration: 1 - Win32 Debug--------------------
Linking...
1.obj : error LNK2001: unresolved external symbol _process
Debug/1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
1.exe - 2 error(s), 0 warning(s)
下面是代码
#include<stdio.h>
void main()
{
int max(int, int);
int min(int, int);
int sum(int, int);
int a,b;
int process(int, int, int(*)());
int (*c)() = max;
printf("Input a and b:");
scanf("%d,%d", &a, &b);
printf("%d,%d\n", a, b);
printf("The max is %d\n", process(a, b, c));
printf("The min is %d\n", process(a, b, min));
printf("The sum is %d\n", process(a, b, sum));
}
int max(int a, int b)
{
if(a > b)
{
return a;
}
else
{
return b;
}
}
int min(int a, int b)
{
if(a > b)
{
return b;
}
else
{
return a;
}
}
int sum(int a, int b)
{
return (a+b);
}
int progress(int a, int b, int(*f)())
{
return (f(a,b));
} int progress(int a, int b, int(*f)())
{
return (f(a,b));
} progress写错了,你前面都是process 谢谢大家,是这个问题
论坛回复的好快啊,真给力!
页:
[1]