Undefined Reference to Function

Hello. I have been learning C++ for about 2 months and I have a problem with a program related to the game bulls and cows. The purpose of the program is to determine the number of bulls and the number of cows by comparing two 4-digit integers. I am using DEV-C++ compiler. When I try to compile my code, I get a message containing the following information: "in function"Z2bcii: undefined reference to int2str(int)". I cannot figure out what the problem is. Can you help me? Thank you in advance.

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
#include<iostream>
#include<string>
#include<cmath>
using namespace std;

string bc(int, int);
string int2str(int);

int main()
{
	string rez;
	cout << "nr1  nr2  nrB  nrC" << endl;
	cout << "_____________________" << endl;
	rez = bc(1204, 8104);
	cout << "1204, 8104" << rez[0] << rez[1] << endl;
	rez = bc(5142, 5142);
	cout << "5142, 5142" << rez[0] << rez[1] << endl;
	return 0;
	
}

string bc(int p, int q)
{
	
	string np = int2str(p);
	string mq = int2str(q);
	int nrB = 0;
	int nrC = 0;
	
	for(int m = 0; m < 4; m++ )
	{
		char cp = np[m];
		for(int n = 0; n < 4; n++)
		{
			if(cp == mq[n])
			{
				(m == n)? nrB++ : nrC++;
			}
		}
		
	}
	
	string s;
	s = s + char(nrB + '0');
	s = s + char(nrC + '0');
	return s;
}


string in2str(int a)
{
	char d;
	string s;
	while(a > 0)
	{
		d = char(a%10 + '0');
		s = d + s;
		a = a/10;
		
	}
	
	return s;
	
}
  
http://www.cplusplus.com/forum/general/113904/#msg622050

1
2
string int2str(int); //declaration
string in2str(int a) // definition 
Topic archived. No new replies allowed.