小弟以前没有学过C++,现在是硬着头皮在自学,在看C++ primer (第三版)这本书抽象容器的时候,有些不是很理解,如是我就照着书上的最后的一个综合类来把书本上的代码敲了进去,可是居然发现有很多错误,不得其解,请各位知道的朋友帮助解释一下?代码没有敲错。完全是照着书本上敲进去的,自己还是看懂了一大部分。
ompiling...
Text1.cpp
d:\my_c++\test_m\containor\text1.cpp(22) : error C2955: 'allocator' : use of class template requires template argument list
d:\program files\microsoft visual studio\vc98\include\xmemory(72) : see declaration of 'allocator'
d:\my_c++\test_m\containor\text1.cpp(23) : error C2955: 'allocator' : use of class template requires template argument list
d:\program files\microsoft visual studio\vc98\include\xmemory(72) : see declaration of 'allocator'
d:\my_c++\test_m\containor\text1.cpp(23) : error C2378: 'text' : redefinition; symbol cannot be overloaded with a typedef
d:\program files\microsoft visual studio\vc98\include\fstream.h(161) : see declaration of 'text'
d:\my_c++\test_m\containor\text1.cpp(24) : error C2059: syntax error : ','
d:\my_c++\test_m\containor\text1.cpp(24) : error C2059: syntax error : '>'
d:\my_c++\test_m\containor\text1.cpp(27) : error C2143: syntax error : missing ';' before '{'
d:\my_c++\test_m\containor\text1.cpp(30) : error C2143: syntax error : missing ';' before '{'
d:\my_c++\test_m\containor\text1.cpp(31) : error C2065: 'TextQuery' : undeclared identifier
d:\my_c++\test_m\containor\text1.cpp(31) : error C2143: syntax error : missing ',' before ')'
d:\my_c++\test_m\containor\text1.cpp(32) : error C2143: syntax error : missing ';' before '}'
d:\my_c++\test_m\containor\text1.cpp(34) : error C2143: syntax error : missing ';' before '{'
d:\my_c++\test_m\containor\text1.cpp(39) : error C2143: syntax error : missing ';' before '{'
d:\my_c++\test_m\containor\text1.cpp(46) : error C2143: syntax error : missing ';' before '}'
d:\my_c++\test_m\containor\text1.cpp(60) : error C2955: 'allocator' : use of class template requires template argument list
d:\program files\microsoft visual studio\vc98\include\xmemory(72) : see declaration of 'allocator'
d:\my_c++\test_m\containor\text1.cpp(62) : error C2955: 'allocator' : use of class template requires template argument list
d:\program files\microsoft visual studio\vc98\include\xmemory(72) : see declaration of 'allocator'
d:\my_c++\test_m\containor\text1.cpp(64) : error C2143: syntax error : missing ';' before '}'
d:\my_c++\test_m\containor\text1.cpp(66) : error C2653: 'TextQuery' : is not a class or namespace name
d:\my_c++\test_m\containor\text1.cpp(69) : error C2143: syntax error : missing ';' before '{'
d:\my_c++\test_m\containor\text1.cpp(75) : error C2143: syntax error : missing ';' before '}'
d:\my_c++\test_m\containor\text1.cpp(78) : error C2653: 'TextQuery' : is not a class or namespace name
d:\my_c++\test_m\containor\text1.cpp(79) : error C2143: syntax error : missing ';' before '{'
d:\my_c++\test_m\containor\text1.cpp(90) : error C2143: syntax error : missing ';' before '{'
d:\my_c++\test_m\containor\text1.cpp(94) : error C2143: syntax error : missing ';' before '}'
d:\my_c++\test_m\containor\text1.cpp(97) : error C2143: syntax error : missing ',' before '.'
d:\my_c++\test_m\containor\text1.cpp(97) : error C2955: 'allocator' : use of class template requires template argument list
d:\program files\microsoft visual studio\vc98\include\xmemory(72) : see declaration of 'allocator'
d:\my_c++\test_m\containor\text1.cpp(101) : error C2065: 'textline' : undeclared identifier
d:\my_c++\test_m\containor\text1.cpp(101) : error C2143: syntax error : missing ',' before ')'
d:\my_c++\test_m\containor\text1.cpp(104) : error C2143: syntax error : missing ';' before '}'
d:\my_c++\test_m\containor\text1.cpp(106) : error C2143: syntax error : missing ';' before '}'
d:\my_c++\test_m\containor\text1.cpp(109) : error C2653: 'TextQuery' : is not a class or namespace name
d:\my_c++\test_m\containor\text1.cpp(110) : error C2143: syntax error : missing ';' before '{'
d:\my_c++\test_m\containor\text1.cpp(111) : error C2065: 'alloctor' : undeclared identifier
d:\my_c++\test_m\containor\text1.cpp(111) : error C2955: 'allocator' : use of class template requires template argument list
d:\program files\microsoft visual studio\vc98\include\xmemory(72) : see declaration of 'allocator'
d:\my_c++\test_m\containor\text1.cpp(112) : error C2955: 'allocator' : use of class template requires template argument list
d:\program files\microsoft visual studio\vc98\include\xmemory(72) : see declaration of 'allocator'
d:\my_c++\test_m\containor\text1.cpp(113) : error C2955: 'allocator' : use of class template requires template argument list
d:\program files\microsoft visual studio\vc98\include\xmemory(72) : see declaration of 'allocator'
d:\my_c++\test_m\containor\text1.cpp(115) : error C2143: syntax error : missing ')' before ';'
d:\my_c++\test_m\containor\text1.cpp(115) : error C2059: syntax error : ')'
d:\my_c++\test_m\containor\text1.cpp(116) : error C2143: syntax error : missing ';' before '{'
d:\my_c++\test_m\containor\text1.cpp(121) : error C2065: 'prev_pos' : undeclared identifier
d:\my_c++\test_m\containor\text1.cpp(121) : error C2143: syntax error : missing ',' before ';'
d:\my_c++\test_m\containor\text1.cpp(123) : error C2137: empty character constant
d:\my_c++\test_m\containor\text1.cpp(123) : error C2065: 'pos' : undeclared identifier
d:\my_c++\test_m\containor\text1.cpp(124) : error C2143: syntax error : missing ';' before '{'
d:\my_c++\test_m\containor\text1.cpp(125) : error C2143: syntax error : missing ',' before ')'
d:\my_c++\test_m\containor\text1.cpp(126) : error C2065: 'word_pos' : undeclared identifier
d:\my_c++\test_m\containor\text1.cpp(129) : error C2143: syntax error : missing ';' before '}'
d:\my_c++\test_m\containor\text1.cpp(130) : error C2143: syntax error : missing ',' before ')'
d:\my_c++\test_m\containor\text1.cpp(133) : error C2143: syntax error : missing ';' before '}'
d:\my_c++\test_m\containor\text1.cpp(134) : error C2065: 'locations' : undeclared identifier
d:\my_c++\test_m\containor\text1.cpp(135) : error C2143: syntax error : missing ';' before '}'
d:\my_c++\test_m\containor\text1.cpp(137) : error C2653: 'TextQuery' : is not a class or namespace name
d:\my_c++\test_m\containor\text1.cpp(138) : error C2143: syntax error : missing ';' before '{'
d:\my_c++\test_m\containor\text1.cpp(142) : error C2955: 'allocator' : use of class template requires template argument list
d:\program files\microsoft visual studio\vc98\include\xmemory(72) : see declaration of 'allocator'
d:\my_c++\test_m\containor\text1.cpp(144) : error C2955: 'allocator' : use of class template requires template argument list
d:\program files\microsoft visual studio\vc98\include\xmemory(72) : see declaration of 'allocator'
d:\my_c++\test_m\containor\text1.cpp(145) : error C2955: 'allocator' : use of class template requires template argument list
d:\program files\microsoft visual studio\vc98\include\xmemory(72) : see declaration of 'allocator'
d:\my_c++\test_m\containor\text1.cpp(148) : error C2143: syntax error : missing ';' before '{'
d:\my_c++\test_m\containor\text1.cpp(154) : error C2143: syntax error : missing ';' before '}'
d:\my_c++\test_m\containor\text1.cpp(155) : error C2143: syntax error : missing ';' before '}'
d:\my_c++\test_m\containor\text1.cpp(157) : error C2653: 'TextQuery' : is not a class or namespace name
d:\my_c++\test_m\containor\text1.cpp(158) : error C2143: syntax error : missing ';' before '{'
d:\my_c++\test_m\containor\text1.cpp(159) : error C2955: 'allocator' : use of class template requires template argument list
d:\program files\microsoft visual studio\vc98\include\xmemory(72) : see declaration of 'allocator'
d:\my_c++\test_m\containor\text1.cpp(161) : error C2955: 'allocator' : use of class template requires template argument list
d:\program files\microsoft visual studio\vc98\include\xmemory(72) : see declaration of 'allocator'
d:\my_c++\test_m\containor\text1.cpp(162) : error C2955: 'allocator' : use of class template requires template argument list
d:\program files\microsoft visual studio\vc98\include\xmemory(72) : see declaration of 'allocator'
d:\my_c++\test_m\containor\text1.cpp(165) : error C2143: syntax error : missing ';' before '{'
d:\my_c++\test_m\containor\text1.cpp(167) : error C2143: syntax error : missing ';' before '{'
d:\my_c++\test_m\containor\text1.cpp(171) : error C2143: syntax error : missing ';' before '}'
d:\my_c++\test_m\containor\text1.cpp(172) : error C2143: syntax error : missing ';' before '}'
d:\my_c++\test_m\containor\text1.cpp(174) : error C2653: 'TextQuery' : is not a class or namespace name
d:\my_c++\test_m\containor\text1.cpp(175) : error C2143: syntax error : missing ';' before '{'
d:\my_c++\test_m\containor\text1.cpp(183) : error C2065: 'suffixes' : undeclared identifier
d:\my_c++\test_m\containor\text1.cpp(183) : error C2065: 'spos' : undeclared identifier
d:\my_c++\test_m\containor\text1.cpp(183) : error C2143: syntax error : missing ',' before ')'
d:\my_c++\test_m\containor\text1.cpp(183) : error C2143: syntax error : missing ',' before ')'
d:\my_c++\test_m\containor\text1.cpp(184) : error C2143: syntax error : missing ',' before ')'
d:\my_c++\test_m\containor\text1.cpp(184) : error C2143: syntax error : missing ',' before ')'
d:\my_c++\test_m\containor\text1.cpp(188) : error C2065: 'ies' : undeclared identifier
d:\my_c++\test_m\containor\text1.cpp(188) : error C2143: syntax error : missing ',' before ')'
d:\my_c++\test_m\containor\text1.cpp(189) : error C2143: syntax error : missing ';' before '{'
d:\my_c++\test_m\containor\text1.cpp(190) : error C2143: syntax error : missing ',' before ')'
d:\my_c++\test_m\containor\text1.cpp(192) : error C2143: syntax error : missing ';' before '}'
d:\my_c++\test_m\containor\text1.cpp(195) : error C2065: 'ses' : undeclared identifier
d:\my_c++\test_m\containor\text1.cpp(195) : error C2143: syntax error : missing ',' before ')'
d:\my_c++\test_m\containor\text1.cpp(196) : error C2143: syntax error : missing ';' before '{'
d:\my_c++\test_m\containor\text1.cpp(199) : error C2143: syntax error : missing ';' before '}'
d:\my_c++\test_m\containor\text1.cpp(208) : error C2143: syntax error : missing ';' before '}'
d:\my_c++\test_m\containor\text1.cpp(210) : error C2653: 'TextQuery' : is not a class or namespace name
d:\my_c++\test_m\containor\text1.cpp(211) : error C2143: syntax error : missing ';' before '{'
d:\my_c++\test_m\containor\text1.cpp(212) : error C2955: 'allocator' : use of class template requires template argument list
d:\program files\microsoft visual studio\vc98\include\xmemory(72) : see declaration of 'allocator'
d:\my_c++\test_m\containor\text1.cpp(214) : error C2955: 'allocator' : use of class template requires template argument list
d:\program files\microsoft visual studio\vc98\include\xmemory(72) : see declaration of 'allocator'
d:\my_c++\test_m\containor\text1.cpp(215) : error C2955: 'allocator' : use of class template requires template argument list
d:\program files\microsoft visual studio\vc98\include\xmemory(72) : see declaration of 'allocator'
d:\my_c++\test_m\containor\text1.cpp(220) : error C2143: syntax error : missing ';' before '{'
d:\my_c++\test_m\containor\text1.cpp(226) : error C2143: syntax error : missing ';' before '}'
d:\my_c++\test_m\containor\text1.cpp(227) : error C2143: syntax error : missing ';' before '}'
d:\my_c++\test_m\containor\text1.cpp(230) : error C2653: 'TextQuery' : is not a class or namespace name
d:\my_c++\test_m\containor\text1.cpp(231) : error C2143: syntax error : missing ';' before '{'
d:\my_c++\test_m\containor\text1.cpp(234) : error C2955: 'allocator' : use of class template requires template argument list
d:\program files\microsoft visual studio\vc98\include\xmemory(72) : see declaration of 'allocator'
d:\my_c++\test_m\containor\text1.cpp(236) : error C2955: 'allocator' : use of class template requires template argument list
d:\program files\microsoft visual studio\vc98\include\xmemory(72) : see declaration of 'allocator'
d:\my_c++\test_m\containor\text1.cpp(238) : error C2955: 'allocator' : use of class template requires template argument list
d:\program files\microsoft visual studio\vc98\include\xmemory(72) : see declaration of 'allocator'
d:\my_c++\test_m\containor\text1.cpp(242) : error C2143: syntax error : missing ';' before '{'
d:\my_c++\test_m\containor\text1.cpp(244) : error C2143: syntax error : missing ';' before '{'
d:\my_c++\test_m\containor\text1.cpp(249) : error C2143: syntax error : missing ',' before '}'
d:\my_c++\test_m\containor\text1.cpp(249) : fatal error C1003: error count exceeds 100; stopping compilation
Error executing cl.exe.
Text1.obj - 102 error(s), 0 warning(s)
对于这个ALLOCATOR 有没有朋友可以帮指点一下。在书本上好像没有怎么讲?而且错误也在多是和它有关。