帮忙找出错误!!!
#include<iostream>#include<string.h>
#include<ctype.h>
using namespace std;
bool GetWord(char * string,char * word,int & wordoffset);
int main()
{
const int buffersize=255;
char buffer[buffersize+1];
char word[buffersize+1];
int wordoffset=0;
cout<<"Enter a string...\n";
cin.getline(buffer,buffersize);
while(GetWord(buffer,word,wordoffset))
{
cout<<"Got this word"<<endl;
}
return 0;
}
bool GerWord(char * string,char * word,int & wordoffset)
{
if(!string[wordoffset])
return false;
char *p1,*p2;
p1=p2=string+wordoffset;
for(int i=0;i<(int)strlen(p1)&&!isalnum(p1[0]);i++)
{ p1++;
}
if(!isalnum(p1[0]))
return false;
p1=p1;
while(!isalnum(p2[0]))
p2++;
int len=int(p2-p1);
strncpy(word,p1,len);
word[len]='\0';
for(int j=int(p2-string);j<(int)strlen(string)&&!isalnum(p2[0]);j++)
{
p2++;
}
wordoffset=int(p2-string);
return true;
}
出现了下面的错误:
Compiling...
zi1.cpp
Linking...
zi1.obj : error LNK2001: unresolved external symbol "bool __cdecl GetWord(char *,char *,int &)" (?GetWord@@YA_NPAD0AAH@Z)
Debug/zi1.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.
zi1.exe - 1 error(s), 0 warning(s)
求高手指点啊!!!!!