compilation error

hi every one.iv wroght a program that is perfectly right but when i depug it the compiler says :error link unresolved external symbol void;

dose any one now what dose it means??
i tried to do many things but no use..
thanks.
post you code? what compiler are your using?
this the complet code:
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*
program discribtion:


*/

//this is the specification part

# include <iostream>
# include <string>
# include <iomanip>

using namespace std;

struct student
{
	int id;
	int Tcridits;
	float gpa;
	string major;
	string department;
	string college;
};

//puting all the prototypes

void addstud(student);
void showstud(student);
void deletstud(student);
void stats(student);
void sis(student);
int num=0;

int main()
{
	student info[50];
    int option;
	do
	{
		cout << endl;
		cout << "Student information System " << endl;
		cout << "      comp2101,assignment3"<<endl;
		cout << "1.Add a new student "<<endl;
		cout << "2.show an Extsting student"<<endl;
		cout << "3.Delet an Existing student"<<endl;
		cout << "4.show statistcs "<<endl;
		cout << "5.print report "<<endl;
		cout << "6.stop"<<endl;
		cout << "enter your option "<<endl;
		cin >> option;
		switch (option)
		{
		case '1':
			addstud(info[50]);
				break;
		case'2':
		    showstud(info[50]);
			break;
		case'3':
		    deletstud(info[50]);
			break;
		case '4':
		    stats(info[50]);
			break;
		case'5':
			sis(info[50]);
			break;
		case'6':
			cout <<"This is the end of the funct program ..."<<endl;
			break;
		default:
			cout <<"pleas enter one of the options !!"<<endl;
		}//end of switch
	}while (option =='6');

	return 0;
}//end of main 

void addstud(student info[50])
{
	cout << "Enter the id number"<<endl;
	cin >> info[num].id;
	cout << endl;
	cout << "Enter total cridets : ";
	cin >> info[num].Tcridits;
	cout << endl;
	cout << "Enter majour :";
	cin >> info[num].major;
	cout << endl;
	cout << "Enter student Departement : ";
	cin >> info[num].department;
	cout << endl;
	cout << "Enter student college :";
	cin >> info[num].college;
	cout << endl;
	cout << "Data added "<<endl;
}//end of add function

void showstud(student info[50])
{   
	int ID;
	cout <<"Enter the id ";
	cin >> ID;
    for (int x=0;x<=num;x++)
	{
		if (info[x].id == ID)
		{
			cout <<"student Id:        "<< info[num].id<<endl;
			cout <<"Total creadits:    "<<info[num].Tcridits<<endl;
			cout <<"Gpa :              "<<info[num].gpa<<endl;
			cout <<"Majour:            "<<info[num].major<<endl;
			cout <<"Department:        "<<info[num].department<<endl;
			cout <<"collage :          "<<info[num].college<<endl;
			return ;
		}//end of if statment
	}
	cout << "the id dose not exist"<<endl;
}//end of function show student

void deletstud(student info[50])
{
	int ID;
	cout << "enter the id: ";
	cin >> ID;
	for (int x=0;x<=num;x++)
	{
		if (info[x].id == ID)
		{
			info[x].id=0;
		cout <<"***student record found and has been deleted****"<<endl;

		}
	}//end of for
	cout << "The student is not found "<<endl;
}//end of the function

void stats(student info[50])
{
	int count1=0;
	int count2=0;

	for (int x=0;x<=num;x++)
	{
		if(info[x].gpa<2.0)
			count1++;
		if (info[x].gpa>3.0 && info[x].Tcridits>50)
			count2++;
	}//end of for
	cout << "Student on probation: " <<count1;
	cout << "Student on Honer list: "<<count2;
}//end of the function

void sis(student info[50])
{
	cout <<"*** Thank you.Here is the final report on student data***"<<endl<<endl;
	cout <<" Student ID "<<setw(6) << " Total Cridits "<<setw(6)<<" Gpa "<< setw(6) <<" Major "<< setw(8) <<" Department "<<setw(13)<<" college "<<endl;
	    

	    for (int x=0;x<=num;x++)
		{
			if (info[x].id != '0' )
			{
				cout << setw(8) <<info[x].id << setw(10) << info[x].Tcridits << setw(13) << info[x].gpa << setw(7) << info[x].major << setw(13)<< info[x].department<<setw(16)<<info[x].college<<endl;
			}
		}//end of for
}//end of the function




these are the errors:
Error 3 error LNK2019: unresolved external symbol "void __cdecl deletstud(struct student)" (?deletstud@@YAXUstudent@@@Z) referenced in function _main HW3.obj
and the same for the other functions.
the compiler says that it can find the file specified.

p.s:what dose HW3.obj means??
Last edited on
the definition of your functions does not match your prototypes.

here's a quick fix:
1. change your prototype to void addstud(student*);
2. call you function like this addstud(info)
thanks it solved the problem^___^
put can i ask :what the symbol * means .
and what did it do ?

any one can tell me what did the symbl * do to cancel the error of linking2109!!
By that you pass a pointer to a student instead of the actual student. That way you actually edit the students you pass to the function instead of copies of them. It's a bit hard to sum this up in a few lines, try reading this: http://www.cplusplus.com/doc/tutorial/pointers/
Oops sorry for late reply, yeah * indicates pointer. just read about arrays and pointers, it's very important.

+1 hanst99
Topic archived. No new replies allowed.