Problem:
I wrote the following subclass for my main program:
#include <stdio.h>
#include <stdlib.h>
#include "function.h"
#define READFILE "r"
#define WRITEFILE "w"
#define WORDARRAYSIZE 16
#define MAXIMUMWORDCHARACTERS 15
void CreateWordList (char inputFileName [ ])
{
FILE* inputFile;
inputFile = fopen (inputFileName, WRITEFILE);
if (inputFile == NULL)
{
fprintf(stderr, "Error - Cannot open %s for reading!\n",
inputFileName);
exit (-1);
}
}
int CountNumberOfWords (FILE* inputFile)
{
int wordCounter = 0;
char wordArray [WORDARRAYSIZE];
while (fgets (wordArray, WORDARRAYSIZE, inputFile) != NULL )
{
wordCounter++;
}
return wordCounter;
}
Basically, I'm just trying to count the number of words in a data file, where you have no idea how many words are actually there. The first function has not been completed and is completely useless in its remedial stages, but somewhere, the following error occurs, “Undefined reference to main c++”