疯了,帮忙看看,连接问题!
每个函数语法没有问题,编译正确,但是连接有问题,怎么回事? #include "stdio.h"
main()
{int i,j,x;
long int s;
double p=0.7;
s=13579;
int bn(int,long int *seed2); //函数声明//
for(i=0;i<10;i++)
{for(j=0;j<5;j++)
{x=bn(p,&s);
printf("%11d",x);
}
printf("\n");
}
}
int bn(double q,long int *seed2) //被主函数调用的函数bn//
{double u;int z;
double uniform(double,double,long int *seed); //函数声明//
u=uniform(0.0,1.0,seed2);
z=(u<=q)?1:0;
return(z);
}
double uniform(double x,double y,long int *seed) //被子函数bn调用的函数uniform//
{double t;
*seed=2045*(*seed)+1;
*seed=*seed-(*seed/1048576)*1048576;
t=(*seed)/1048576.0;
t=x+(y-x)*t;
return(t);
}
显示:Linking...
bn1.obj : error LNK2001: unresolved external symbol "int __cdecl bn(int,long *)" (?bn@@YAHHPAJ@Z)
Debug/bn.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.
怎么回事?