By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,247 Members | 1,250 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,247 IT Pros & Developers. It's quick & easy.

Problem on using "template" in VC/C++ 6.0

P: n/a
Hi all,

I am new to c++ but using c for long time. Recently, I created a MFC
GUI project by VC/C++ 6.0. Everything was fine until I wanted to use
"template":

template <typename T>
class AutoComPtr { ...

The following errors were shown:

..\external\include\autocom.hpp(18) : error C2059: syntax error : '>'
..\external\include\autocom.hpp(62) : error C2992: 'AutoComPtr' :
invalid or missing template parameter list
.\external\include\autocom.hpp(62) : see declaration of
'AutoComPtr'
..\external\include\autocom.hpp(67) : error C2059: syntax error : '>'
Furthermore, I even can't include "<iostream>" (but "iostream.h"). It
gave the following errors in the file "iosfwd":

C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(215) :
error C2079: '$S202' uses undefined class '$S202'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(215) :
error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(260) :
error C2975: 'allocator' : invalid template argument for '$S202',
constant expression expected
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(216) : see
declaration of 'allocator'

Could anyone tell me what're the error about. Thanks so much.

Best Regards,
Jacky

Aug 22 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Jacky Yuk wrote:
I am new to c++ but using c for long time. Recently, I created a MFC
GUI project by VC/C++ 6.0. Everything was fine until I wanted to use
"template":

template <typename T>
class AutoComPtr { ...

The following errors were shown:

.\external\include\autocom.hpp(18) : error C2059: syntax error : '>'
.\external\include\autocom.hpp(62) : error C2992: 'AutoComPtr' :
invalid or missing template parameter list
.\external\include\autocom.hpp(62) : see declaration of
'AutoComPtr'
.\external\include\autocom.hpp(67) : error C2059: syntax error : '>'
And where are the lines 18, 62, and 67? Have you read the FAQ? You
should, you know. Before posting again.
[...]


V
Aug 22 '05 #2

P: n/a

"Jacky Yuk" <ja*******@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Hi all,

I am new to c++ but using c for long time. Recently, I created a MFC
GUI project by VC/C++ 6.0. Everything was fine until I wanted to use
"template":

template <typename T>
class AutoComPtr { ...

The following errors were shown:

.\external\include\autocom.hpp(18) : error C2059: syntax error : '>'
.\external\include\autocom.hpp(62) : error C2992: 'AutoComPtr' :
invalid or missing template parameter list
.\external\include\autocom.hpp(62) : see declaration of
'AutoComPtr'
.\external\include\autocom.hpp(67) : error C2059: syntax error : '>'
Furthermore, I even can't include "<iostream>" (but "iostream.h"). It
gave the following errors in the file "iosfwd":

C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(215) :
error C2079: '$S202' uses undefined class '$S202'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(215) :
error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(260) :
error C2975: 'allocator' : invalid template argument for '$S202',
constant expression expected
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(216) : see
declaration of 'allocator'

Could anyone tell me what're the error about. Thanks so much.

Best Regards,
Jacky


Although you should upgrade to more standard-compliant compilers (e.g.
VC7.1), the error is most likely caused by your code. It could be a typo or
something more serious. Perhaps posting the lines where errors occur might
give us more clue to help you help yourself.

Ben
Aug 22 '05 #3

P: n/a
Hi,

Thx so much, it looks to be the problem of other codes. It can be
compiled if I put the statements before some codes. I am now
invesgating my program. Furthermore, sorry for the unclear questions, I
will read the faq before next post.

Best Regards,
Jacky

Aug 22 '05 #4

P: n/a
"Jacky Yuk" <ja*******@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
Hi,

Thx so much, it looks to be the problem of other codes. It can be
compiled if I put the statements before some codes. I am now
invesgating my program. Furthermore, sorry for the unclear questions, I
will read the faq before next post.

Best Regards,
Jacky


I concider 6.0 broken. I used to use it when it was the latest. It doesn't
seem to support <iostream> but only the older <iostream.h> type headers.
Other things don't work in it as well. I'm using Microsoft Visual C++ .net
2003 now and all those problems go away (although I only use c++ not the
..net managed stuff).
Sep 2 '05 #5

P: n/a
Jim Langston wrote:
[..]
I concider 6.0 broken. I used to use it when it was the latest. It doesn't
seem to support <iostream> but only the older <iostream.h> type headers.
This is simply not true.
Other things don't work in it as well. I'm using Microsoft Visual C++ .net
2003 now and all those problems go away (although I only use c++ not the
.net managed stuff).


That's true, OTOH.

V
Sep 2 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.