Errors with my C++ code

The entirety of my error:
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
scrab101.cpp: In function ‘void drawreplace(char&, char&, char&, char&, char&, std::ifstream&)’:
scrab101.cpp:1159: error: no match foroperator<<’ in ‘scrab101 << "replace "’
scrab101.cpp:1160: error: no matching function for call to ‘std::vector<char, std::allocator<char> >::erase(int)’
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:110: note: candidates are: typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = char, _Alloc = std::allocator<char>]
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:122: note:                 typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >, __gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = char, _Alloc = std::allocator<char>]
scrab101.cpp:1164: error: no match foroperator<<’ in ‘scrab101 << "replace "’
scrab101.cpp:1165: error: no matching function for call to ‘std::vector<char, std::allocator<char> >::erase(int)’
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:110: note: candidates are: typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = char, _Alloc = std::allocator<char>]
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:122: note:                 typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >, __gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = char, _Alloc = std::allocator<char>]
scrab101.cpp:1169: error: no match foroperator<<’ in ‘scrab101 << "replace "’
scrab101.cpp:1170: error: no matching function for call to ‘std::vector<char, std::allocator<char> >::erase(int)’
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:110: note: candidates are: typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = char, _Alloc = std::allocator<char>]
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:122: note:                 typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >, __gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = char, _Alloc = std::allocator<char>]
scrab101.cpp:1174: error: no match foroperator<<’ in ‘scrab101 << "replace "’
scrab101.cpp:1175: error: no matching function for call to ‘std::vector<char, std::allocator<char> >::erase(int)’
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:110: note: candidates are: typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = char, _Alloc = std::allocator<char>]
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:122: note:                 typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >, __gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = char, _Alloc = std::allocator<char>]
scrab101.cpp:1179: error: no match foroperator<<’ in ‘scrab101 << "replace "’
scrab101.cpp:1180: error: ‘bcpm’ was not declared in this scope
scrab101.cpp:1184: error: no match foroperator<<’ in ‘scrab101 << "replace "’
scrab101.cpp:1185: error: no matching function for call to ‘std::vector<char, std::allocator<char> >::erase(int)’
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:110: note: candidates are: typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = char, _Alloc = std::allocator<char>]
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:122: note:                 typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >, __gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = char, _Alloc = std::allocator<char>]
scrab101.cpp:1189: error: no match foroperator<<’ in ‘scrab101 << "replace "’
scrab101.cpp:1190: error: no matching function for call to ‘std::vector<char, std::allocator<char> >::erase(int)’
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:110: note: candidates are: typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = char, _Alloc = std::allocator<char>]
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:122: note:                 typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >, __gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = char, _Alloc = std::allocator<char>]
scrab101.cpp:1249: error: no match foroperator<<’ in ‘scrab101 << "draw "’
scrab101.cpp:1253: error: expected primary-expression before ‘char’
scrab101.cpp:1253: error: expected primary-expression before ‘char’
scrab101.cpp:1253: error: expected primary-expression before ‘char’
scrab101.cpp:1253: error: expected primary-expression before ‘char’
scrab101.cpp:1253: error: expected primary-expression before ‘char’
scrab101.cpp: In function ‘int main()’:
scrab101.cpp:2047: error: invalid initialization of reference of type ‘std::ifstream&’ from expression of type ‘std::ofstream’
scrab101.cpp:924: error: in passing argument 6 of ‘void drawreplace(char&, char&, char&, char&, char&, std::ifstream&)’
caen-vnc02% 


My whole code is far too long to post, so I will just describe the parts around where it doesn't seem to be working... I am declaring and opening an ifstream in int main, and then I am calling a procedure which uses that ifstream. The ifstream is not declared, opened or closed in the procedure. I am calling 5 chars and the ifstream all by reference in the procedure. I am cannot figure out what is wrong. The "no match for opporator <<" is absolutely baffeling to me.

I'd appreciate any help I can get, thank you.
This is my procedure:

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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
void drawreplace(char & ch1, char & ch2, char & ch3, char & ch4, char & ch5, ifstream & scrab101) // draw and replace
{ 
	vector <char> current(5);
	current[0] = ch1;
	current[1] = ch2;
	current[2] = ch3;
	current[3] = ch4;
	current[4] = ch5;
	vector <char> qz(5);
	vector <char> jx(5);
	vector <char> k(5);
	vector <char> fhvwy(5);
	vector <char> bcmp(5);
	vector <char> dg(5);
	vector <char> aeilnorstu(5);
	switch(current[0]){
		case 'q':
		case 'z':
		qz.push_back(ch1);
		break;
		case 'j':
		case 'x':
		jx.push_back(ch1);
		break;
		case 'k':
		k.push_back(ch1);
		break;
		case 'f':
		case 'h':
		case 'v':
		case 'w':
		case 'y':
		fhvwy.push_back(ch1);
		break;
		case 'b':
		case 'c':
		case 'm':
		case 'p':
		bcmp.push_back(ch1);
		break;
		case 'd':
		case 'g':
		dg.push_back(ch1);
		break;
		case 'a':
		case 'e':
		case 'i':
		case 'l':
		case 'n':
		case 'o':
		case 'r':
		case 's':
		case 't':
		case 'u':
		aeilnorstu.push_back(ch1);
		break;
	}
	switch(current[1]){
		case 'q':
		case 'z':
		qz.push_back(ch2);
		break;
		case 'j':
		case 'x':
		jx.push_back(ch2);
		break;
		case 'k':
		k.push_back(ch2);
		break;
		case 'f':
		case 'h':
		case 'v':
		case 'w':
		case 'y':
		fhvwy.push_back(ch2);
		break;
		case 'b':
		case 'c':
		case 'm':
		case 'p':
		bcmp.push_back(ch2);
		break;
		case 'd':
		case 'g':
		dg.push_back(ch2);
		break;
		case 'a':
		case 'e':
		case 'i':
		case 'l':
		case 'n':
		case 'o':
		case 'r':
		case 's':
		case 't':
		case 'u':
		aeilnorstu.push_back(ch2);
		break;
	}
	switch(current[2]){
		case 'q':
		case 'z':
		qz.push_back(ch3);
		break;
		case 'j':
		case 'x':
		jx.push_back(ch3);
		break;
		case 'k':
		k.push_back(ch3);
		break;
		case 'f':
		case 'h':
		case 'v':
		case 'w':
		case 'y':
		fhvwy.push_back(ch3);
		break;
		case 'b':
		case 'c':
		case 'm':
		case 'p':
		bcmp.push_back(ch3);
		break;
		case 'd':
		case 'g':
		dg.push_back(ch3);
		break;
		case 'a':
		case 'e':
		case 'i':
		case 'l':
		case 'n':
		case 'o':
		case 'r':
		case 's':
		case 't':
		case 'u':
		aeilnorstu.push_back(ch3);
		break;
	}
	switch(current[3]){
		case 'q':
		case 'z':
		qz.push_back(ch4);
		break;
		case 'j':
		case 'x':
		jx.push_back(ch4);
		break;
		case 'k':
		k.push_back(ch4);
		break;
		case 'f':
		case 'h':
		case 'v':
		case 'w':
		case 'y':
		fhvwy.push_back(ch4);
		break;
		case 'b':
		case 'c':
		case 'm':
		case 'p':
		bcmp.push_back(ch4);
		break;
		case 'd':
		case 'g':
		dg.push_back(ch4);
		break;
		case 'a':
		case 'e':
		case 'i':
		case 'l':
		case 'n':
		case 'o':
		case 'r':
		case 's':
		case 't':
		case 'u':
		aeilnorstu.push_back(ch4);
		break;
	}
	switch(current[4]){
		case 'q':
		case 'z':
		qz.push_back(ch5);
		break;
		case 'j':
		case 'x':
		jx.push_back(ch5);
		break;
		case 'k':
		k.push_back(ch5);
		break;
		case 'f':
		case 'h':
		case 'v':
		case 'w':
		case 'y':
		fhvwy.push_back(ch5);
		break;
		case 'b':
		case 'c':
		case 'm':
		case 'p':
		bcmp.push_back(ch5);
		break;
		case 'd':
		case 'g':
		dg.push_back(ch5);
		break;
		case 'a':
		case 'e':
		case 'i':
		case 'l':
		case 'n':
		case 'o':
		case 'r':
		case 's':
		case 't':
		case 'u':
		aeilnorstu.push_back(ch5);
		break;
	}
	int qzsize, jxsize, ksize, fhvwysize, bcmpsize, dgsize, aeilnorstusize;
	qzsize = qz.size();
	jxsize = jx.size();
	ksize = k.size();
	fhvwysize = fhvwy.size();
	bcmpsize = bcmp.size();
	dgsize = dg.size();
	aeilnorstusize = aeilnorstu.size();
	if(qzsize != 0)
	{
		scrab101 << "replace " << qz[0] << endl;
		qz.erase(0);
	}
	else if(jxsize != 0)
	{
		scrab101 << "replace " << jx[0] << endl;
		jx.erase(0);
	}
	else if(ksize != 0)
	{
		scrab101 << "replace " << k[0] << endl;
		k.erase(0);
	}
	else if(fhvwysize != 0)
	{
		scrab101 << "replace " << fhvwy[0] << endl;
		fhvwy.erase(0);
	}
	else if(bcmpsize != 0)
	{
		scrab101 << "replace " << bcmp[0] << endl;
		bcpm.erase(0);
	}
	else if(dgsize != 0)
	{
		scrab101 << "replace " << dg[0] << endl;
		dg.erase(0);
	}
	else if(aeilnorstusize != 0)
	{
		scrab101 << "replace " << aeilnorstu[0] << endl;
		aeilnorstu.erase(0);
	}
	qzsize = qz.size();
	jxsize = jx.size();
	ksize = k.size();
	fhvwysize = fhvwy.size();
	bcmpsize = bcmp.size();
	dgsize = dg.size();
	aeilnorstusize = aeilnorstu.size();
	vector <char> newstring(5);
	int n = 0;
	int m;
	m = qzsize;
	for(m; m > 0; m--)
	{
		newstring[n] = qz[m-1];
		n++;
	}
	m = jxsize;
	for(m; m > 0; m--)
	{
		newstring[n] = qz[m-1];
		n++;
	}
	m = ksize;
	for(m; m > 0; m--)
	{
		newstring[n] = qz[m-1];
		n++;
	}
	m = fhvwysize;
	for(m; m > 0; m--)
	{
		newstring[n] = qz[m-1];
		n++;
	}
	m = bcmpsize;
	for(m; m > 0; m--)
	{
		newstring[n] = qz[m-1];
		n++;
	}
	m = dgsize;
	for(m; m > 0; m--)
	{
		newstring[n] = qz[m-1];
		n++;
	}
	m = aeilnorstusize;
	for(m; m > 0; m--)
	{
		newstring[n] = qz[m-1];
		n++;
	}
	ch1 = newstring[0];
	ch2 = newstring[1];
	ch3 = newstring[2];
	ch4 = newstring[3];
	ch5 = singlerand(ch1);
	scrab101 << "draw " << ch5 << endl;
	bool q = anyword(ch1);
	if(!q)
	{
		drawreplace(char & ch1, char & ch2, char & ch3, char & ch4, char & ch5);
	}
	else
	{
		return;
	}
}
Oh Dear:
As far as the errors are concerned:


You have 7 error messages that say:
error: no match foroperator<<’ in ‘scrab101 << "replace "

and one error that says:
error: no match foroperator<<’ in ‘scrab101 << "draw "


That is because scrab101 is an ifstream (input file stream) and you are using the output
operator <<
You obviously cannot output to an input stream.

This ties in with the errors
error: invalid initialization of reference of type ‘std::ifstream&’ from expression of type ‘std::ofstream’ and error: in passing argument 6 of ‘void drawreplace(char&, char&, char&, char&, char&, std::ifstream&)
Think about that.....


And this:
drawreplace(char & ch1, char & ch2, char & ch3, char & ch4, char & ch5); is NOT the way to call a function.
That's why you are getting 5 errors about char
Also have you got a drawreplace function overload that takes only 5 char parameters??? or are you trying recursion??
Thank you,

I was trying to use recursion. I fixed the issue with calling it an ofstream instead of an ifstream, and I fixxed the recursion issue (I added ofstream & scrab101 to the end), but I am still getting a lot of errors.

scrab101.cpp: In function \u2018void drawreplace(char&, char&, char&, char&, char&, std::ofstream&)\u2019:
scrab101.cpp:1160: error: no matching function for call to \u2018std::vector<char, std::allocator<char> >::erase(int)\u2019
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:110: note: candidates are: typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = char, _Alloc = std::allocator<char>]
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:122: note:                 typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >, __gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = char, _Alloc = std::allocator<char>]
scrab101.cpp:1165: error: no matching function for call to \u2018std::vector<char, std::allocator<char> >::erase(int)\u2019
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:110: note: candidates are: typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = char, _Alloc = std::allocator<char>]
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:122: note:                 typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >, __gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = char, _Alloc = std::allocator<char>]
scrab101.cpp:1170: error: no matching function for call to \u2018std::vector<char, std::allocator<char> >::erase(int)\u2019
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:110: note: candidates are: typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = char, _Alloc = std::allocator<char>]
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:122: note:                 typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >, __gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = char, _Alloc = std::allocator<char>]
scrab101.cpp:1175: error: no matching function for call to \u2018std::vector<char, std::allocator<char> >::erase(int)\u2019
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:110: note: candidates are: typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = char, _Alloc = std::allocator<char>]
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:122: note:                 typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >, __gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = char, _Alloc = std::allocator<char>]
scrab101.cpp:1180: error: \u2018bcpm\u2019 was not declared in this scope
scrab101.cpp:1185: error: no matching function for call to \u2018std::vector<char, std::allocator<char> >::erase(int)\u2019
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:110: note: candidates are: typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = char, _Alloc = std::allocator<char>]
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:122: note:                 typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >, __gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = char, _Alloc = std::allocator<char>]
scrab101.cpp:1190: error: no matching function for call to \u2018std::vector<char, std::allocator<char> >::erase(int)\u2019
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:110: note: candidates are: typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = char, _Alloc = std::allocator<char>]
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:122: note:                 typename std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >, __gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = char, _Alloc = std::allocator<char>]
scrab101.cpp:1253: error: expected primary-expression before \u2018char\u2019
scrab101.cpp:1253: error: expected primary-expression before \u2018char\u2019
scrab101.cpp:1253: error: expected primary-expression before \u2018char\u2019
scrab101.cpp:1253: error: expected primary-expression before \u2018char\u2019
scrab101.cpp:1253: error: expected primary-expression before \u2018char\u2019
scrab101.cpp:1253: error: expected primary-expression before \u2018&\u2019 token
Last edited on
I was expecting those vector errors - you are not using the erase function of the vector correctly.
The vector::erase function uses iterators.

See here:
http://www.cplusplus.com/reference/stl/vector/erase/

Okay, I got the vector erase thing to work, but I still have primary expression errors where I try to use recursion.

Thanks
Last edited on
What does that particular line look like now??
Topic archived. No new replies allowed.