fatal error?

lidajun0717 2012-04-01 07:14:14

#include <iostream>
#include<cstring>
using namespace std;

const char map[] = {2, 2, 2, 3, 3, 3, 4, 4, 4,
5, 5, 5, 6, 6, 6, 7, 0, 7,
7, 8, 8, 8, 9, 9, 9};

typedef char (*Tel)[16];

int Deal(Tel telephone, Tel result, int count[], int nCases);
void Output(Tel result, int count[], int nCount);

int main()
{
int nCases;
int index = 0;
cin >> nCases;
Tel telephone = new char[nCases][16];
Tel result = new char[nCases][16];
int *count = new int[nCases];

char temp[16];
while (index < nCases)
{
cin >> temp;
strcmp(telephone[index++], temp);
}

int nCount = Deal(telephone, result, count, nCases);
Output(result, count, nCount);

delete []count;
delete []telephone;
delete []result;
return 0;
}

int Deal(Tel telephone, Tel result, int count[], int nCases)
{
char temp[16];
int nCount = 0;
temp[8] = '\0';
for (int i = 0; i < nCases; i++)
count[i] = 0;

for (int i = 0; i < nCases; i++)
{
int len = strlen(telephone[i]);
int k = 0;
int j;
for (j = 0; j < len; j++)
{
if (telephone[i][j] != '-')
temp[k++] = map[telephone[i][j]-'A'];
if (k == 3)
temp[k++] = '-';
}

for (j = 0; j < nCount; j++)
if (strcmp(temp, result[j]) == 0)
{
count[j]++;
break;
}

if (j == nCount) {
strcpy(result[nCount++], temp);
count[nCount-1]++;
}
}

return nCount;
}

void output(Tel result, int count[], int nCount)
{
for (int i = 0; i < nCount; i++)
cout << result[i] << " " << count[i] << endl;
}


1>1001.obj : error LNK2019: 无法解析的外部符号 "void __cdecl Output(char (*)[16],int * const,int)" (?Output@@YAXPAY0BA@DQAHH@Z),该符号在函数 _main 中被引用

用的是vs2010~~~
...全文
80 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
loongee 2012-04-01
  • 打赏
  • 举报
回复
快申请结贴吧~~~
pengfoo 2012-04-01
  • 打赏
  • 举报
回复
的确,一般报这种无法解析的外部符号,原因都是函数没有定义,(或者是找不到链接库,或者是头文件没有包含),你这里是函数名写错了。相当于函数没有定义。
lidajun0717 2012-04-01
  • 打赏
  • 举报
回复
我2了,output写错了~~~

64,642

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

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