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

template-class-id redefined problem

P: n/a
Hi Guys,
I have some problem in compiling the following code, specially with
MSVC++.Net2003 (Code works fine with GCC compiler)
=========================================
template< typename PROTOCOL>
class port:public smart::smart_port<
typename PROTOCOL::transport::output::type,
typename PROTOCOL::transport::input::type >
{
private:
/* Handy typedefs*/
typedef port<PROTOCOL> my_type;
typedef typename PROTOCOL::transport::input::type input_interface;
typedef typename PROTOCOL::transport::output::type
output_interface;

typedef smart::smart_port<
output_interface,
input_interface
base_port_type;


port(my_type& port_,unsigned int id=0):
base_port_type(sc_gen_unique_name ("port"),
port_,id),
view(this)
{
}
port(base_port_type& port,unsigned int id=0):
base_port_type(sc_gen_unique_name ("port"),port,id),
view(this)
{
}
};
========================================
MS compiler complians about error C2942: 'pse::port<PROTOCOL>' :
template-class-id redefined as a formal argument of a function

This error appears at the second constructor i.e. line containing code
"port(base_port_type& port,unsigned int id=0):"

Do you have any clue about the problem and how it can be sloved.

AS

Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
sa*************@rediffmail.com wrote:
I have some problem in compiling the following code, specially with
MSVC++.Net2003 (Code works fine with GCC compiler)
=========================================
template< typename PROTOCOL>
class port:public smart::smart_port<
typename PROTOCOL::transport::output::type,
typename PROTOCOL::transport::input::type >
{
private:
/* Handy typedefs*/
typedef port<PROTOCOL> my_type;
Have you tried simply

typedef port my_type;

?
typedef typename PROTOCOL::transport::input::type input_interface;
typedef typename PROTOCOL::transport::output::type
output_interface;

typedef smart::smart_port<
output_interface,
input_interface
> base_port_type;
port(my_type& port_,unsigned int id=0):
base_port_type(sc_gen_unique_name ("port"),
port_,id),
view(this)
{
}
port(base_port_type& port,unsigned int id=0):
base_port_type(sc_gen_unique_name ("port"),port,id),
view(this)
{
}
};
========================================
MS compiler complians about error C2942: 'pse::port<PROTOCOL>' :
template-class-id redefined as a formal argument of a function


I don't see "pse" here anywhere. Are there any macros you didn't tell
us about?

This error appears at the second constructor i.e. line containing code
"port(base_port_type& port,unsigned int id=0):"

Do you have any clue about the problem and how it can be sloved.


Could you reproduce the same error message in a simpler setting, and
post the complete code so that we could try compiling it?

V
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.