473,399 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

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,client>::pointer_to_temp lated_class_member* templated_class_name<base,client><base,client>::te mplated_class_member(arguments) {
...
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+RIFgekOSN5f8SCQ8RQ==</Id>
Nov 17 '05 #1
4 1140
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*******@dotnet247.com> wrote in message
news:Oq**************@tk2msftngp13.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,client>::pointer_to_temp lated_class_member* templated_class_name<base,client><base,client>::te mplated_class_member(argum
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+RIFgekOSN5f8SCQ8RQ==</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*******@dotnet247.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<class base, class client>
templated_class_name<base,client>::pointer_to_tem plated_class_member* templated_class_name<base,client><base,client>::te mplated_class_member(arguments) {
That needs to be:

template<class base, class client>
typename
templated_class_name<base,client>::pointer_to_temp lated_class_member*
templated_class_name<base,client>::templated_class _member(arguments) {

(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
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...
13
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
by: Mr.Tickle | last post by:
So whats the deal here regarding Generics in the 2004 release and templates currently in C++?
0
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...
11
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
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)...
25
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...
3
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...
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
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...
0
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...

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.