Hi, I am working on a C program and I got the following function:
Code:
int printCount(char* fileName)
{
struct Node* current;
current = head;
int unique = 0;
int total = 0;
printf("filename: %s\n\n", fileName);
printf("COUNT | WORD\n");
printf("------+------------------\n");
while (current)
{
unique +=1;
total +=current->count;
printf("%5d | %s\n", current->count, current->word);
current = current->next;
}
printf("\n\n");
printf("Number of Unique words found in %s is %d\n", fileName,
unique);
printf("Total number of words in %s is %d\n", fileName, total);
}
I am compiling this code with the SUN cc compiler and it gives me the following errors on these lines:
' int unique = 0;'
syntax error before or at: int
'unique +=1;'
undefined symbol: unique
'total +=current->count;'
undefined symbol: total
'printf("Number of Unique words found in %s is %d\n", fileName,
unique);'
undefined symbol: unique
'printf("Total number of words in %s is %d\n", fileName, total);'
undefined symbol: total
When I compile this program with the Unix gcc compiler it doesn't give me any errors, but as soon as I compile it with the cc compiler it throws me those "undefined symbol" errors. Does anyone know why?
Thank you.