高手这里来
狂砍八条街 2008-11-19 07:09:49 这是源代码:
// Fig. 4.19: fig04_19.cpp
// Linear search of an array
#include <iostream.h>
int linearSearch(const int[],int,int);
int main()
{
const int arraySize = 100;
int a[arraySize],searchKey,element;
for(int x=0;x<arraySize;x++) // create some data
a[x]=2*x;
cout<<"Enter integer search key:"<<endl;
cin>>searchKey;
element=linearSearch(a,searchKey,arraySize);
if(element!=-1)
cout<<"Found value in element "<<element<<endl;
else
cout<<"Value not found"<<endl;
return 0;
}
int linearsearch( const int arraay[], int key, int sizeofArray )
{
for(int n=0;n<sizeofArray;n++)
if(arraay[n]==key)
return n;
return -1;
}
报错信息:error LNK2001: unresolved external symbol "int __cdecl linearSearch(int const * const,int,int)" (?linearSearch@@YAHQBHHH@Z)
//Debug/fig_04_19.exe : fatal error LNK1120: 1 unresolved externals
请问一下高手,怎么解决这个问题,还有报错的原因是什么?