I get this error and I'm not sure how to fix it. This is a project for information retrieval where i am trying to calculate tf-idf using this type (1+log(freq(t,n)))*log(N/k). freq(t,n) is the frequency of a word, t in file n and N is the number of total files, k number of files that contain the word t.
Undefined first referenced
symbol in file
log /var/tmp//ccx8E8Y1.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
here is my fuction where I get the error (i have #include <math.h>
in the start):
void makeTF_IDF(char** words,double** weight,char** str){
int i,j,n,f;
char nameout[1024],line[1024];
double tf,idf[1443],t;
FILE *fin;
for(i=0;i<1443;i++){
n=0;
for(j=0;j<26;j++){
strcpy(nameout,strtok(str[j],"."));
strcat(nameout,"out.txt");
fin=fopen(nameout,"r");
while(1){
if(fgets(line,1024,fin)==NULL) break;
if(strstr(line,words[i])!=NULL){
n++;
break;
}
}
fclose(fin);
}
t=26/n;
idf[i]=log(t);
}
for(i=0;i<1443;i++){
for(j=0;j<26;j++){
f=0;
strcpy(nameout,strtok(str[j],"."));
strcat(nameout,"out.txt");
fin=fopen(nameout,"r");
while(1){
if(fgets(line,1024,fin)==NULL) break;
if(strstr(line,words[i])!=NULL) f++;
}
weight[j][i]=(log(1+f))*idf[i];
fclose(fin);
}
}
}