473,785 Members | 2,575 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

question templates in managed c

hello, i have an old library i need to port to .net. the old library is written in visual c++ 6.0 and uses templated classes.
if i compile the library (after having gone through the conversion wizard), i get errors with the definitions of the templated classes. below are some examples.

template<class base, class client>
templated_class _name<base,clie nt>::pointer_to _templated_clas s_member* templated_class _name<base,clie nt><base,client >::templated_cl ass_member(argu ments) {
...
code here
... }

for this function i receive the error
error C2143: syntax error : missing ';' before '*'

i did some reading on the templated classes in managed c maybe the synatx changed, but i can't find the problem. maybe you have run into this problem also, and you could advise.

thanks,
Ana Farcas

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>DqU+RIFgekO SN5f8SCQ8RQ==</Id>
Nov 17 '05 #1
4 1174
for your information :
'templates' are called 'generics' and are available in .NET 2.0 (whidbey)

so, have a look at how to use 'generics'. maybe you'll find an answer there
http://www.15seconds.com/issue/031024.htm

h.t.h
Chris

"Ana Farcas via .NET 247" <an*******@dotn et247.com> wrote in message
news:Oq******** ******@tk2msftn gp13.phx.gbl...
hello, i have an old library i need to port to .net. the old library is written in visual c++ 6.0 and uses templated classes. if i compile the library (after having gone through the conversion wizard), i get errors with the definitions of the templated classes. below
are some examples.
template<class base, class client>
templated_class _name<base,clie nt>::pointer_to _templated_clas s_member* templated_class _name<base,clie nt><base,client >::templated_cl ass_member(argu m
ents) { ..
code here
.. }

for this function i receive the error
error C2143: syntax error : missing ';' before '*'

i did some reading on the templated classes in managed c maybe the synatx changed, but i can't find the problem. maybe you have run into this problem
also, and you could advise.
thanks,
Ana Farcas

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>DqU+RIFgekO SN5f8SCQ8RQ==</Id>

Nov 17 '05 #2
Ana Farcas via .NET 247 wrote:
for this function i receive the error
error C2143: syntax error : missing ';' before '*'
It's not clear from the code snippet what is causing this error. If you can
send me a preprocessed file, I can take a look. (Take online out of my email
address).
i did some reading on the templated classes in managed c maybe the synatx
changed, but i can't find the problem. maybe you have run into this
problem also, and you could advise.


If you are referring to templates for ref classes and value classes, this is
not supported in the 7.0 and 7.1 versions of the compiler. We are
introducing that support in VC 2005 (currently in beta).

If you are not doing managed programming, which I suspect is the case, the
syntax for templates has changed only slightly. Newer versions of the
compiler support more template features like partial specialization, and are
more restrictive for ill-formed code.

--
Brandon Bray, Visual C++ Compiler http://blogs.msdn.com/branbray/
This posting is provided AS IS with no warranties, and confers no rights.
Nov 17 '05 #3
Chris wrote:
for your information :
'templates' are called 'generics' and are available in .NET 2.0


Just to avoid confusion, both generics and templates are available in VC
2005. They are different things. More information on my blog:

http://blogs.msdn.com/branbray/archi.../19/51023.aspx

--
Brandon Bray, Visual C++ Compiler http://blogs.msdn.com/branbray/
This posting is provided AS IS with no warranties, and confers no rights.
Nov 17 '05 #4
On Mon, 09 Aug 2004 07:00:13 -0700, Ana Farcas via .NET 247
<an*******@dotn et247.com> wrote:
hello, i have an old library i need to port to .net. the old library is written in visual c++ 6.0 and uses templated classes.
if i compile the library (after having gone through the conversion wizard), i get errors with the definitions of the templated classes. below are some examples.

template<cla ss base, class client>
templated_clas s_name<base,cli ent>::pointer_t o_templated_cla ss_member* templated_class _name<base,clie nt><base,client >::templated_cl ass_member(argu ments) {
That needs to be:

template<class base, class client>
typename
templated_class _name<base,clie nt>::pointer_to _templated_clas s_member*
templated_class _name<base,clie nt>::templated_ class_member(ar guments) {

(typename added). VC6 didn't require typename, VC7.1 does require it.
..
code here
.. }

for this function i receive the error
error C2143: syntax error : missing ';' before '*'

i did some reading on the templated classes in managed c maybe the synatx changed, but i can't find the problem. maybe you have run into this problem also, and you could advise.


I don't think the syntax change has anything to do with managed C++,
but purely to do with the major increase in standard C++ conformance
between VC6 and VC7.1. If you don't know about "typename" as used
above, look it up in your favourite reference under "dependent names"
or similar.

Tom
Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

44
4285
by: lester | last post by:
a pre-beginner's question: what is the pros and cons of .net, compared to ++ I am wondering what can I get if I continue to learn C# after I have learned C --> C++ --> C# ?? I think there must be many know the answer here. thanks
13
2269
by: Jason Swett | last post by:
I want to do graphics with C++. Surprisingly, so far nobody has been able to tell me anything helpful. How do I do it? Any input would be greatly appreciated. Jason
2
3106
by: Mr.Tickle | last post by:
So whats the deal here regarding Generics in the 2004 release and templates currently in C++?
0
930
by: WithPit | last post by:
I am creating a wrapper around an existing C++ library. A lot of classes and methods are wrapped but there are still some little problems. One of the problem is the use of templates in C++ which does not exists in managed languages like C# (i am talking here about C# 1.1 version, not 2.0 which has some generics options). How can i get rid of classes that are defined or using templates stuctures like Object<T>? Thanx
11
1826
by: Peter Oliphant | last post by:
Is there any plan to support templates with managed code in the (near) future? For instance, VS.NET 2005... : )
1
1328
by: Greg | last post by:
Referring to Managed: why do templates require an explicit copy constructor to be defined in order to use gcnew whereas simply declaring an object as a local (still uses managed heap of course) does not require the template to have a default constructor defined? -- Greg McPherran www.McPherran.com
25
3338
by: Ted | last post by:
I'm putting the posts that follow here (hopefully they will follow here!) because they were rejected in comp.lang.c++.moderated. It behooves anyone reading them to first read the the thread of the same subject in clc++m to get the more of the context. Ted
3
4008
by: Steven T. Hatton | last post by:
Has anybody here used explicit instantiation of templates? Has it worked well? Are there any issues to be aware of? -- NOUN:1. Money or property bequeathed to another by will. 2. Something handed down from an ancestor or a predecessor or from the past: a legacy of religious freedom. ETYMOLOGY: MidE legacie, office of a deputy, from OF, from ML legatia, from L legare, to depute, bequeath. www.bartleby.com/61/
2
7667
by: Ken Fine | last post by:
I want to add the security question and answer security feature to the ChangePassword control. I am aware that this functionality is built into the PasswordRecovery tool. I have implemented the PasswordRecovery with a Password reset required; a temporary password is sent to the account on file. I want an extra layer of security to accommodate the very unlikely contingency that someone's e-mail account is compromised. Challenging with the...
0
9645
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
9480
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
10148
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
10091
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
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8972
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...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3646
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.