fatal error?该怎么处理
fatal error?
1>1001.obj : error LNK2019: 无法解析的外部符号 "void __cdecl Output(char (*)[16],int * const,int)" (?Output@@YAXPAY0BA@DQAHH@Z),该符号在函数 _main 中被引用
用的是vs2010~~~
------解决方案--------------------
的确,一般报这种无法解析的外部符号,原因都是函数没有定义,(或者是找不到链接库,或者是头文件没有包含),你这里是函数名写错了。相当于函数没有定义。
------解决方案--------------------
快申请结贴吧~~~
- C/C++ code
#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~~~
------解决方案--------------------
的确,一般报这种无法解析的外部符号,原因都是函数没有定义,(或者是找不到链接库,或者是头文件没有包含),你这里是函数名写错了。相当于函数没有定义。
------解决方案--------------------
快申请结贴吧~~~