Undefined reference question

I am almost done with this project or I was at one point but lost my finished project. I am getting 2 different errors. What am I doing wrong?
Undefined reference to countChars
ld returned exit status 


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#include<iostream>
#include<cctype>
#include<fstream>
#include<cstdio>
#include<string>
using namespace std;
typedef struct Count {int countChars, countNW, countAlpha, countDigits, countPunctuation;}Count;
Count Counts;
int readChars(ifstream&, Count[]);
int countChars(Count&, char line[]);
int countNW(Count&, char line[]);
int countAlpha(Count&, char line[]);
int countDigits(Count&, char line[]);
int countPunctuation(Count&, char line[]);
int main()
{
        Count Count;
        int i; //repeater
        ifstream input;
        string fname;

        //Intro
        cout << "Welcome to this program.\n";
        cout << "Please enter text file you use.\n";
        cin >> fname;
        //opening file if correct
        input.open(fname.c_str());
        if(input.fail())
        {
                cout << "Not a valid filename\n";
                exit(0);
                cout << "Not a valid filename\n";
                exit(0);
        }
        char line[80];  //number of lines in the file being read
        char delims[]= ",\t\n"; // delimeters: space, ',', tab, return

        while (input.getline(line,80))
        {
                cout << "lines, line";
                countChars(Count, line);
                countNW(Count, line);
                countAlpha(Count, line);
                countDigits(Count, line);
                countPunctuation(Count, line);
        }
}
/* Function: countChars
 * Input: characters
 * Output:Counts letters on the line
 * Description: Counts letters in each line
*/
int countChar(Count& Count, char line[])
{
        Count.countChars=0;
        int i=0; //Repeater
        char letter; //each individual letters in the line
        while(line[i] != '\0')
        {
            {
                Count.countChars++;
            }
            i++;
        }
}
/* Function: countNW
 * Input:Spaces and returns
 * Output: Count the number of non white spaces
 * Description: Counts number of non white spaces
*/
int countNW(Count& Count, char line[])
{
    Count.countNW=0;
    int i=0; //Repeater
    char d;
    while(line[i] != '\0')
    {
        d=line[i];
        if (!isspace(d))
        {
            Count.countNW++;
        }
        i++;
    }
}
/* Function: countAplha
 * Input:Alphabetical characters
 * Output:Counts the number of alphabetical characters
 * Description:
*/
int countAlpha(Count& Count, char line[])
{
        Count.countAlpha=0;
        int i=0; //Repeater
        while(line[i] != '\0')
        {
            if (isalpha(line[i]))
            {
                Count.countAlpha++;
            }
                i++;
        }
}
/* Function: countDigits
 * Input:numbers
 * Output:Counts the number of numbers usage
*/
int countDigits(Count& Count, char line[])
{
    Count.countDigits=0;
    int i=0;
    while (line[i] != '\0')
    {
        if (isdigit(line[i]))
        {
            Count.countDigits++;
        }
            i++;
    }
}
/* Function: countPunctuation
 * Input:Punctuations
 * Output:Counts the numver of punctuation usages
*/
int countPunctuations(Count& Count, char line[])
{
        Count.countPunctuation=0;
        int i=0; //repeater
        int d=0;
        while (line[i] != '\0')
        {
            if (ispunct(line[i]))
            {
                Count.countPunctuation++;
            }
            i++;
            d++;
        }
}
1
2
3
int countChars(Count& Count, char line[]) {
// happy code 
}


I think you just missed the s in your definition
Typo.
CountChars != CountChar.
Yeah, it was as simple as that. xD Thank you very much.
Topic archived. No new replies allowed.