error LNK2001: unresolved external symbol "bool __cdecl yz(char (* const)[10])"

Yan之有理 2015-12-09 12:40:42
数独游戏代码,求大神解决:
原来有一个音频,我不大懂那个,运行起来头文件还提示有错误,我不懂,我就把它注释掉了!还一个彩色文本,我也注释掉了。
编译的时候没错误没警告,但是一创建就不行了出现了以下这种情况:
--------------------Configuration: Cpp1 - Win32 Debug--------------------
Linking...
Cpp1.obj : error LNK2001: unresolved external symbol "bool __cdecl yz(char (* const)[10])" (?yz@@YA_NQAY09D@Z)
Debug/Cpp1.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.

Cpp1.exe - 1 error(s), 0 warning(s)



下面是我改过的数独游戏代码:
#include <iostream>
#include <cstdlib> //随机函数
#include <ctime> //系统时间
//#include "pcc32.h" //彩色文本
//#include <mmsystem.h>
#pragma comment(lib, "pcc32_vc6.lib")
//#pragma comment(lib,"winmm.lib")
using namespace std;
bool yz(char b[9][10]); //验证子函数,验证每一行,每一列,每一个3x3宫格都是1-9.
void main()
{
// PlaySound((char*)"kanong.wav",NULL,SND_ASYNC|SND_LOOP);
char a[9][10]={{"493761528"},
{"582943167"},
{"716528349"},
{"139674852"},
{"658219734"},
{"247835691"},
{"975382416"},
{"821456973"},
{"364197285"}};

int b[81],c[81],q=0,p=0;
int k,x;
do{
// setTextColor(14);
cout<<" *^0^*<<<<<欢迎进入数独游戏>>>>>*^0^*\n";
// setTextColor(10);
cout<<"请选择游戏的难易级别为?(3—高,2—中,1—低):"<<endl;
cin>>k;
switch(k)
{
int i,j,m,n,gs;
case 1:

srand((int)time(0));
for(gs=0;gs<30;gs++)//随机在已经布满的9x9宫格里,运用随机数,并且以系统时间为参数,随机产生空白字符,
{ //低难度的数独,每次产生的空白字符为22个左右,
m=(int)(10*rand()/(RAND_MAX+1.0));
n=(int)(10*rand()/(RAND_MAX+1.0));
a[m][n]=' ';
b[q]=m; //将随机产生的空白字符的坐标分别存在b,c两个数组中.
c[p]=n;
q++;
p++;
}
b[30]=10,c[30]=10;
do
{
// setTextColor(15);
cout<<" 1 2 3 4 5 6 7 8 9"<<endl;
// setTextColor(3);
cout<<" __________________"<<endl;
cout<<" ‖----------------------------------‖"<<endl;
for(i=0;i<3;i++)
{
// setTextColor(15);
cout<<" "<<(i+1)<<" ";
for(j=0;j<9;j++) //输出不同颜色的题目字符和空白字符.
{
if(j%3!=0)
{
// setTextColor(3);
cout<<"| ";
for(q=0,p=0;q<31,p<31;q++,p++) //将随机的空白字符单独表示出来,并且以另一种颜色输出表示.
{
if(i==b[q]&&j==c[p])
{
// setTextColor(14);
cout<<a[i][j];
break;
}
if(q==30&&p==30) //将剩下的题目字符用另一种颜色输出表示
{
// setTextColor(12);
cout<<a[i][j];
}
}
// setTextColor(3);
cout<<" ";
}
else
{
// setTextColor(3);
cout<<"‖";
for(q=0,p=0;q<31,p<31;q++,p++)
{
if(i==b[q]&&j==c[p])
{
// setTextColor(14);
cout<<a[i][j];
break;
}
if(q==30&&p==30)
{
// setTextColor(12);
cout<<a[i][j];
}
}
// setTextColor(3);
cout<<" ";
}
}
// setTextColor(3);
cout<<"‖"<<endl;
}
// setTextColor(3);
cout<<" ‖==================================‖"<<endl;
cout<<" ‖==================================‖"<<endl;
for(i=3;i<6;i++)
{
// setTextColor(15);
cout<<" "<<(i+1)<<" ";
for(j=0;j<9;j++)
{
if(j%3!=0)
{
// setTextColor(3);
cout<<"| ";
for(q=0,p=0;q<31,p<31;q++,p++)
{
if(i==b[q]&&j==c[p])
{
// setTextColor(14);
cout<<a[i][j];
break;
}
if(q==30&&p==30)
{
// setTextColor(12);
cout<<a[i][j];
}
}
// setTextColor(3);
cout<<" ";
}
else
{
// setTextColor(3);
cout<<"‖";
for(q=0,p=0;q<31,p<31;q++,p++)
{
if(i==b[q]&&j==c[p])
{
// setTextColor(14);
cout<<a[i][j];
break;
}
if(q==30&&p==30)
{
// setTextColor(12);
cout<<a[i][j];
}
}
// setTextColor(3);
cout<<" ";
}
}
// setTextColor(3);
cout<<"‖"<<endl;
}
// setTextColor(3);
cout<<" ‖==================================‖"<<endl;
cout<<" ‖==================================‖"<<endl;
for(i=6;i<9;i++)
{
// setTextColor(15);
cout<<" "<<(i+1)<<" ";
for(j=0;j<9;j++)
{
if(j%3!=0)
{
// setTextColor(3);
cout<<"| ";
for(q=0,p=0;q<31,p<31;q++,p++)
{
if(i==b[q]&&j==c[p])
{
// setTextColor(14);
cout<<a[i][j];
break;
}
if(q==30&&p==30)
{
// setTextColor(12);
cout<<a[i][j];
}
}
// setTextColor(3);
cout<<" ";
}
else
{
// setTextColor(3);
cout<<"‖";
for(q=0,p=0;q<31,p<31;q++,p++)
{
if(i==b[q]&&j==c[p])
{
// setTextColor(14);
cout<<a[i][j];
break;
}
if(q==30&&p==30)
{
// setTextColor(12);
cout<<a[i][j];
}
}
// setTextColor(3);
cout<<" ";
}
}
// setTextColor(3);
cout<<"‖"<<endl;
}
// setTextColor(3);
cout<<" ‖----------------------------------‖"<<endl;
cout<<"  ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄"<<endl;
if(yz(a)==true) break;
// setTextColor(10);
cout<<"请输入要输入数字的坐标,以及要填入的数字(先行后列):"<<endl; //输入每次要输入的数字.
cin>>m>>n;
for(q=0,p=0;q<31,p<31;q++,p++) //判断所输入坐标是否应填的字符,若是,则输入所要输入的数字,若不是,则报错误,并且重新输入.
{
if(m-1==b[q]&&n-1==c[p])
{
cin>>a[m-1][n-1];
break;
}
if(q==30&&p==30) cout<<"输入有错,该位置为题目数字,请重新输入: \n";
}
cout<<"**************************************************************************"<<endl;
}while(true);
// setTextColor(12);
cout<<"恭喜你过关!"<<endl;
break;
}
// case 2: //与case1类似。
// case 3: //同上。
// setTextColor(10);
cout<<"是否希望继续游戏: 1-继续,2-退出!"<<endl;
cin>>x;
}while(x==1);
// setTextColor(14);
// cout<<" /*^0^*\ 谢谢使用,欢迎下次继续参与本游戏。"<<endl<<"祝您有个好心情!"<<endl;
}
...全文
351 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
bear234 2015-12-23
  • 打赏
  • 举报
回复
连接器错误: 你告诉编译器:我会给你一个函数:bool __cdecl yz(char (* const)[10]) 编译器说:OK 知道了 到时候让连接器找这个函数的定义 连接器:对不起 我没找到 也就是说,你没有定义它
paschen 2015-12-09
  • 打赏
  • 举报
回复
bool yz(char b[9][10]); 这个函数,你前面声明了,但没有实现

3,882

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 其它技术问题
社区管理员
  • 其它技术问题社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧