Undefined reference error?

I get this strange linker error when I compile my code...

/tmp/ccO8yU7S.o: In function `bad_date(int, Date::Month, int)':
main.cpp:(.text+0xf5): undefined reference to `leapyear(int)'
collect2: error: ld returned 1 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
  	bool bad_date(int y, Date::Month  m, int d)
{
    if (y<1582) return false;
	
	if (m>12) return false;

    if (d<=0) return false;            // d must be positive

    int days_in_month = 31;            // most months have 31 days
	
	
    switch (m) {
case Date::february:                        // the length of February varies
    days_in_month = (leapyear(y))?29:28;
    break;
case Date::april: case Date::june: case Date::september: case Date::november:
    days_in_month = 30;                // the rest have 30 days
    break;
    }

    if (days_in_month<d) return false;

    return true;
} 

And here's where I declared it in my header...
1
2
bool bad_date(int y, Date::Month m, int d); //bad_date finds valid dates
bool leapyear(int y);


Thanks in advance guys.
The compiler does not see the definition of function leapyear.
How can I make it find the definition?
First of all you should define the function.
Yeah I tossed this in there
1
2
3
bool leapyear(int y) {
	return false;
	}

Compiled now, I thought that was in there but I must have cut it. Thanks.
Topic archived. No new replies allowed.