473,836 Members | 1,983 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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\inc lude\autocom.hp p(18) : error C2059: syntax error : '>'
..\external\inc lude\autocom.hp p(62) : error C2992: 'AutoComPtr' :
invalid or missing template parameter list
.\external\incl ude\autocom.hpp (62) : see declaration of
'AutoComPtr'
..\external\inc lude\autocom.hp p(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\INC LUDE\iosfwd(215 ) :
error C2079: '$S202' uses undefined class '$S202'
C:\Program Files\Microsoft Visual Studio\VC98\INC LUDE\iosfwd(215 ) :
error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\Microsoft Visual Studio\VC98\INC LUDE\iosfwd(260 ) :
error C2975: 'allocator' : invalid template argument for '$S202',
constant expression expected
C:\Program Files\Microsoft Visual Studio\VC98\INC LUDE\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
5 3599
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\incl ude\autocom.hpp (18) : error C2059: syntax error : '>'
.\external\incl ude\autocom.hpp (62) : error C2992: 'AutoComPtr' :
invalid or missing template parameter list
.\external\incl ude\autocom.hpp (62) : see declaration of
'AutoComPtr'
.\external\incl ude\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

"Jacky Yuk" <ja*******@gmai l.com> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.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\incl ude\autocom.hpp (18) : error C2059: syntax error : '>'
.\external\incl ude\autocom.hpp (62) : error C2992: 'AutoComPtr' :
invalid or missing template parameter list
.\external\incl ude\autocom.hpp (62) : see declaration of
'AutoComPtr'
.\external\incl ude\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\INC LUDE\iosfwd(215 ) :
error C2079: '$S202' uses undefined class '$S202'
C:\Program Files\Microsoft Visual Studio\VC98\INC LUDE\iosfwd(215 ) :
error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\Microsoft Visual Studio\VC98\INC LUDE\iosfwd(260 ) :
error C2975: 'allocator' : invalid template argument for '$S202',
constant expression expected
C:\Program Files\Microsoft Visual Studio\VC98\INC LUDE\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
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
"Jacky Yuk" <ja*******@gmai l.com> wrote in message
news:11******** *************@z 14g2000cwz.goog legroups.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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1882
by: Gianni Mariani | last post by:
I remember seeing a neat template specialization trick posted here a few months ago that allowed the detection of a type containing a member. After a day searching through google archives I come up zip. Anyhow, after much trial and error I came up with this. This "contains_member" template sets value to 1 if the type D contains a typedef named MEMBER of type TD.
10
1787
by: Lionel B | last post by:
Greetings, I cannot figure out why the following code does not compile: --- BEGIN CODE --- typedef double ftype(double); struct A {
2
2025
by: Rudy Ray Moore | last post by:
Whenever I get any error with Vc++7.1/.net/2003, it is followed by huge ammounts of "template assistance" error messaging referencing template code (MTL) that has nothing to do with the error. This makes it difficult to spot errors. For example, F4 to "jump to next error" just jumps ot the next "template assistance" message. And since there are hundreds of them, this is quite obnoxious. Can I disable these things? Why is MSVC...
2
1591
by: Brent | last post by:
Like many sites, mine has a standard "look" -- a template, if you will -- that visitors see on each page. I've tried to keep the code and HTML separate to the extent possible, and for most standard page presentations, it works well. However, I have a couple of screen scrape / import routines that can take minutes, even hours, to complete. I'd like to have some way of outputting my template first to the browser, and then within the...
9
3353
by: Kobe | last post by:
Is there any difference in: template <class T> vs. template <typename T> ?
0
1964
by: Robbie Hatley | last post by:
I'd always thougth that a C++ compiler/linker should be able to instantiate a template in mulitple places (say, in two different translation units), even using the same template parameters so that the resulting functions or classes are identical, without causing any errors. Or so I thought. But a few days ago, I added a couple of new template functions to one of my personal library modules, and I got this linker error message (from...
1
1997
by: Robbie Hatley | last post by:
I asked about this yesterday, but no one bit. So I'll ask again. I can be a persistant cuss. :-) I ran into a problem a few days ago when I added a couple of template functions to one of my personal library headers. My library, librh.a, has these objects: rhutil.o rhdir.o rhmath.o rhbitmap.o and matching headers: rhutil.h rhdir.h rhmath.h rhbitmap.h
2
2806
by: Robbie Hatley | last post by:
"Victor Bazarov" <v.Abazarov@comAcast.net> wrote: > Robbie Hatley wrote: > > > > I ran into a problem a few days ago when I added a couple of > > template functions to one of my personal library headers. > > > > My library, librh.a > > Linking is not defined by C++ .
2
2062
by: Hukkky | last post by:
File : NodeList.h //---------------------------------------------------------------------- #ifndef NODELIST_H #define NODELIST_H #include <string> using std::string; template <typename T> class NodeList {
0
9812
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9658
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10534
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10579
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9364
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6975
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5644
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4444
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4004
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.