no copy constructor available - error C2558 
Author Message
 no copy constructor available - error C2558

Hi,

I am getting compile error when using template map. I try to use map
functionality, but got the compile error -- CScrollC<double>::tstuctLine' :
no copy constructor available

I tried to use both the template format as well as just treating it like a
class... here is my code. Your help would be appreciated... thanks in
advance.

class CTry: public CWnd
{
protected:

typedef map<double,double> MAPDATA;

typedef struct {
 MAPDATA m_mapData;
 int a, b;

Quote:
} tstructLine;

 typedef map<UINT, tstuctLine> MAPLINE;
 MAPLINE m_mapLines;

...

Quote:
}// class

I also tried the followings so as to fake the STL syntax... (I probably do
this wrong though!) But same compile error occurs.

template<class T>
class CTry: public CWnd
{
protected:
....//same as above

Quote:
}//class



Mon, 27 Dec 2004 07:42:14 GMT  
 no copy constructor available - error C2558

Quote:
> I am getting compile error when using template map. I try to use map
> functionality, but got the compile error -- CScrollC<double>::tstuctLine'
:
> no copy constructor available
<snip>
> typedef struct {
>  MAPDATA m_mapData;
>  int a, b;
> } tstructLine;

>  typedef map<UINT, tstuctLine> MAPLINE;

Pardon the obvious question, but is it related to the fact you're missing an
'r' in your map declaration?  tstuctLine -> tstructLine?

Or is that just a transcription error?

Ken



Mon, 27 Dec 2004 04:50:34 GMT  
 no copy constructor available - error C2558
No. I cut and paste my code to this message, and hence the typo. Sorry.

However, the error is there with no typo.

Thanks again.


Quote:


> > I am getting compile error when using template map. I try to use map
> > functionality, but got the compile error --

CScrollC<double>::tstuctLine'
Quote:
> :
> > no copy constructor available
> <snip>
> > typedef struct {
> >  MAPDATA m_mapData;
> >  int a, b;
> > } tstructLine;

> >  typedef map<UINT, tstuctLine> MAPLINE;

> Pardon the obvious question, but is it related to the fact you're missing
an
> 'r' in your map declaration?  tstuctLine -> tstructLine?

> Or is that just a transcription error?

> Ken



Mon, 27 Dec 2004 07:56:18 GMT  
 no copy constructor available - error C2558
Hmm, could you give us more information, including the full error message
and the line of code that generates the error message?

I compiled the code (minus the MFC stuff) successfully on my machine...

Ken


Quote:
> No. I cut and paste my code to this message, and hence the typo. Sorry.

> However, the error is there with no typo.

> Thanks again.





> > > I am getting compile error when using template map. I try to use map
> > > functionality, but got the compile error --
> CScrollC<double>::tstuctLine'
> > :
> > > no copy constructor available
> > <snip>
> > > typedef struct {
> > >  MAPDATA m_mapData;
> > >  int a, b;
> > > } tstructLine;

> > >  typedef map<UINT, tstuctLine> MAPLINE;

> > Pardon the obvious question, but is it related to the fact you're
missing
> an
> > 'r' in your map declaration?  tstuctLine -> tstructLine?

> > Or is that just a transcription error?

> > Ken



Mon, 27 Dec 2004 06:17:37 GMT  
 no copy constructor available - error C2558
Here is the error message. Thanks for your help.

Compiling...
ScrollC.cpp
d:\program files\microsoft visual studio\vc98\include\utility(21) : error
C2558: struct 'tstuctLine' : no copy constructor available
        d:\program files\microsoft visual studio\vc98\include\utility(21) :
while compiling class-template member function '__thiscall
std::pair<unsigned int const ,struct tstuctLine>::std::pair<unsigned int
const ,struct tstuctLine>(const unsigned
int &,const tstuctLine &)'
Error executing cl.exe.

ScrollC.obj - 1 error(s), 0 warning(s)


Quote:
> Hmm, could you give us more information, including the full error message
> and the line of code that generates the error message?

> I compiled the code (minus the MFC stuff) successfully on my machine...

> Ken



> > No. I cut and paste my code to this message, and hence the typo. Sorry.

> > However, the error is there with no typo.

> > Thanks again.





> > > > I am getting compile error when using template map. I try to use map
> > > > functionality, but got the compile error --
> > CScrollC<double>::tstuctLine'
> > > :
> > > > no copy constructor available
> > > <snip>
> > > > typedef struct {
> > > >  MAPDATA m_mapData;
> > > >  int a, b;
> > > > } tstructLine;

> > > >  typedef map<UINT, tstuctLine> MAPLINE;

> > > Pardon the obvious question, but is it related to the fact you're
> missing
> > an
> > > 'r' in your map declaration?  tstuctLine -> tstructLine?

> > > Or is that just a transcription error?

> > > Ken



Tue, 28 Dec 2004 00:59:28 GMT  
 no copy constructor available - error C2558
I think you should give us a FULL program instead of code sniplets, because
this compiles fine on VC6 and VC7.
What's your compiler version?
Are you using the Microsoft STL, or some replacement?

Luc K


Quote:
> Hi,

> I am getting compile error when using template map. I try to use map
> functionality, but got the compile error -- CScrollC<double>::tstuctLine'
:
> no copy constructor available

> I tried to use both the template format as well as just treating it like a
> class... here is my code. Your help would be appreciated... thanks in
> advance.

> class CTry: public CWnd
> {
> protected:

> typedef map<double,double> MAPDATA;

> typedef struct {
>  MAPDATA m_mapData;
>  int a, b;
> } tstructLine;

>  typedef map<UINT, tstuctLine> MAPLINE;
>  MAPLINE m_mapLines;

> ...
> }// class

> I also tried the followings so as to fake the STL syntax... (I probably do
> this wrong though!) But same compile error occurs.

> template<class T>
> class CTry: public CWnd
> {
> protected:
> ....//same as above

> }//class



Mon, 27 Dec 2004 22:14:45 GMT  
 no copy constructor available - error C2558
I don't find the program.
Did you forget to include it?

Luc K


Quote:
> Here is the error message. I am using VP6 SP5. Thanks for your help.

> Compiling...
> ScrollC.cpp
> d:\program files\microsoft visual studio\vc98\include\utility(21) : error
> C2558: struct 'tstuctLine' : no copy constructor available
>         d:\program files\microsoft visual studio\vc98\include\utility(21)
:
> while compiling class-template member function '__thiscall
> std::pair<unsigned int const ,struct tstuctLine>::std::pair<unsigned int
> const ,struct tstuctLine>(const unsigned
> int &,const tstuctLine &)'
> Error executing cl.exe.

> ScrollC.obj - 1 error(s), 0 warning(s)



> > I think you should give us a FULL program instead of code sniplets,
> because
> > this compiles fine on VC6 and VC7.
> > What's your compiler version?
> > Are you using the Microsoft STL, or some replacement?

> > Luc K



> > > Hi,

> > > I am getting compile error when using template map. I try to use map
> > > functionality, but got the compile error --
> CScrollC<double>::tstuctLine'
> > :
> > > no copy constructor available

> > > I tried to use both the template format as well as just treating it
like
> a
> > > class... here is my code. Your help would be appreciated... thanks in
> > > advance.

> > > class CTry: public CWnd
> > > {
> > > protected:

> > > typedef map<double,double> MAPDATA;

> > > typedef struct {
> > >  MAPDATA m_mapData;
> > >  int a, b;
> > > } tstructLine;

> > >  typedef map<UINT, tstuctLine> MAPLINE;
> > >  MAPLINE m_mapLines;

> > > ...
> > > }// class

> > > I also tried the followings so as to fake the STL syntax... (I
probably
> do
> > > this wrong though!) But same compile error occurs.

> > > template<class T>
> > > class CTry: public CWnd
> > > {
> > > protected:
> > > ....//same as above

> > > }//class



Mon, 27 Dec 2004 23:58:13 GMT  
 no copy constructor available - error C2558
Here is the error message. I am using VP6 SP5. Thanks for your help.

Compiling...
ScrollC.cpp
d:\program files\microsoft visual studio\vc98\include\utility(21) : error
C2558: struct 'tstuctLine' : no copy constructor available
        d:\program files\microsoft visual studio\vc98\include\utility(21) :
while compiling class-template member function '__thiscall
std::pair<unsigned int const ,struct tstuctLine>::std::pair<unsigned int
const ,struct tstuctLine>(const unsigned
int &,const tstuctLine &)'
Error executing cl.exe.

ScrollC.obj - 1 error(s), 0 warning(s)


Quote:
> I think you should give us a FULL program instead of code sniplets,
because
> this compiles fine on VC6 and VC7.
> What's your compiler version?
> Are you using the Microsoft STL, or some replacement?

> Luc K



> > Hi,

> > I am getting compile error when using template map. I try to use map
> > functionality, but got the compile error --

CScrollC<double>::tstuctLine'
Quote:
> :
> > no copy constructor available

> > I tried to use both the template format as well as just treating it like
a
> > class... here is my code. Your help would be appreciated... thanks in
> > advance.

> > class CTry: public CWnd
> > {
> > protected:

> > typedef map<double,double> MAPDATA;

> > typedef struct {
> >  MAPDATA m_mapData;
> >  int a, b;
> > } tstructLine;

> >  typedef map<UINT, tstuctLine> MAPLINE;
> >  MAPLINE m_mapLines;

> > ...
> > }// class

> > I also tried the followings so as to fake the STL syntax... (I probably
do
> > this wrong though!) But same compile error occurs.

> > template<class T>
> > class CTry: public CWnd
> > {
> > protected:
> > ....//same as above

> > }//class



Tue, 28 Dec 2004 02:45:30 GMT  
 no copy constructor available - error C2558
I think I know where it fails. The declaration seems to be compiled ok.
However, once I put in codes and it fails to compile with no copy
constructor in the VC include file called utility. Any idea? Thanks for your
help again!

Quote:
> > Compiling...
> > ScrollC.cpp
> > d:\program files\microsoft visual studio\vc98\include\utility(21) :
error
> > C2558: struct 'tstuctLine' : no copy constructor available
> >         d:\program files\microsoft visual

studio\vc98\include\utility(21)

Quote:
> :
> > while compiling class-template member function '__thiscall
> > std::pair<unsigned int const ,struct tstuctLine>::std::pair<unsigned int
> > const ,struct tstuctLine>(const unsigned
> > int &,const tstuctLine &)'
> > Error executing cl.exe.

void CTry::SetRange(double dLower, double dUpper, int nDecimalPlaces, int
nPen)
{
   if (m_setLinesID.find(nPen) == m_setLinesID.end()) return;
  m_mapLines[nPen].m_dLowerLimit     = dLower ;
  m_mapLines[nPen].m_dUpperLimit     = dUpper ;

Quote:
}  // SetRange



Quote:
> I don't find the program.
> Did you forget to include it?

> Luc K



> > Here is the error message. I am using VP6 SP5. Thanks for your help.

> > Compiling...
> > ScrollC.cpp
> > d:\program files\microsoft visual studio\vc98\include\utility(21) :
error
> > C2558: struct 'tstuctLine' : no copy constructor available
> >         d:\program files\microsoft visual

studio\vc98\include\utility(21)
Quote:
> :
> > while compiling class-template member function '__thiscall
> > std::pair<unsigned int const ,struct tstuctLine>::std::pair<unsigned int
> > const ,struct tstuctLine>(const unsigned
> > int &,const tstuctLine &)'
> > Error executing cl.exe.

> > ScrollC.obj - 1 error(s), 0 warning(s)



> > > I think you should give us a FULL program instead of code sniplets,
> > because
> > > this compiles fine on VC6 and VC7.
> > > What's your compiler version?
> > > Are you using the Microsoft STL, or some replacement?

> > > Luc K



> > > > Hi,

> > > > I am getting compile error when using template map. I try to use map
> > > > functionality, but got the compile error --
> > CScrollC<double>::tstuctLine'
> > > :
> > > > no copy constructor available

> > > > I tried to use both the template format as well as just treating it
> like
> > a
> > > > class... here is my code. Your help would be appreciated... thanks
in
> > > > advance.

> > > > class CTry: public CWnd
> > > > {
> > > > protected:

> > > > typedef map<double,double> MAPDATA;

> > > > typedef struct {
> > > >  MAPDATA m_mapData;
> > > >  int a, b;
> > > > } tstructLine;

> > > >  typedef map<UINT, tstuctLine> MAPLINE;
> > > >  MAPLINE m_mapLines;

> > > > ...
> > > > }// class

> > > > I also tried the followings so as to fake the STL syntax... (I
> probably
> > do
> > > > this wrong though!) But same compile error occurs.

> > > > template<class T>
> > > > class CTry: public CWnd
> > > > {
> > > > protected:
> > > > ....//same as above

> > > > }//class



Tue, 28 Dec 2004 04:08:40 GMT  
 no copy constructor available - error C2558
IMHO you should try to put together a small program which reproduces the
error that you're seeing.
Post it here. I bet you'll have an answer to your problem within 24 hours...

Luc K


Quote:
> I think I know where it fails. The declaration seems to be compiled ok.
> However, once I put in codes and it fails to compile with no copy
> constructor in the VC include file called utility. Any idea? Thanks for
your
> help again!

> > > Compiling...
> > > ScrollC.cpp
> > > d:\program files\microsoft visual studio\vc98\include\utility(21) :
> error
> > > C2558: struct 'tstuctLine' : no copy constructor available
> > >         d:\program files\microsoft visual
> studio\vc98\include\utility(21)
> > :
> > > while compiling class-template member function '__thiscall
> > > std::pair<unsigned int const ,struct tstuctLine>::std::pair<unsigned
int
> > > const ,struct tstuctLine>(const unsigned
> > > int &,const tstuctLine &)'
> > > Error executing cl.exe.

> void CTry::SetRange(double dLower, double dUpper, int nDecimalPlaces, int
> nPen)
> {
>    if (m_setLinesID.find(nPen) == m_setLinesID.end()) return;
>   m_mapLines[nPen].m_dLowerLimit     = dLower ;
>   m_mapLines[nPen].m_dUpperLimit     = dUpper ;
> }  // SetRange



> > I don't find the program.
> > Did you forget to include it?

> > Luc K



> > > Here is the error message. I am using VP6 SP5. Thanks for your help.

> > > Compiling...
> > > ScrollC.cpp
> > > d:\program files\microsoft visual studio\vc98\include\utility(21) :
> error
> > > C2558: struct 'tstuctLine' : no copy constructor available
> > >         d:\program files\microsoft visual
> studio\vc98\include\utility(21)
> > :
> > > while compiling class-template member function '__thiscall
> > > std::pair<unsigned int const ,struct tstuctLine>::std::pair<unsigned
int
> > > const ,struct tstuctLine>(const unsigned
> > > int &,const tstuctLine &)'
> > > Error executing cl.exe.

> > > ScrollC.obj - 1 error(s), 0 warning(s)



> > > > I think you should give us a FULL program instead of code sniplets,
> > > because
> > > > this compiles fine on VC6 and VC7.
> > > > What's your compiler version?
> > > > Are you using the Microsoft STL, or some replacement?

> > > > Luc K



> > > > > Hi,

> > > > > I am getting compile error when using template map. I try to use
map
> > > > > functionality, but got the compile error --
> > > CScrollC<double>::tstuctLine'
> > > > :
> > > > > no copy constructor available

> > > > > I tried to use both the template format as well as just treating
it
> > like
> > > a
> > > > > class... here is my code. Your help would be appreciated... thanks
> in
> > > > > advance.

> > > > > class CTry: public CWnd
> > > > > {
> > > > > protected:

> > > > > typedef map<double,double> MAPDATA;

> > > > > typedef struct {
> > > > >  MAPDATA m_mapData;
> > > > >  int a, b;
> > > > > } tstructLine;

> > > > >  typedef map<UINT, tstuctLine> MAPLINE;
> > > > >  MAPLINE m_mapLines;

> > > > > ...
> > > > > }// class

> > > > > I also tried the followings so as to fake the STL syntax... (I
> > probably
> > > do
> > > > > this wrong though!) But same compile error occurs.

> > > > > template<class T>
> > > > > class CTry: public CWnd
> > > > > {
> > > > > protected:
> > > > > ....//same as above

> > > > > }//class



Tue, 28 Dec 2004 02:19:54 GMT  
 no copy constructor available - error C2558
Hi,

Could you post a sample project which is able to reproduce the problem?
That will be most helpful to pinpoint the problem and solution.

Thanks,
HuangTM
This posting is provided "AS IS" with no warranties, and confers no rights.



Tue, 28 Dec 2004 15:44:01 GMT  
 no copy constructor available - error C2558
    Your error message is reporting an error for tstuctline NOT tstructline,
I still believe it is generated
due to the typo.  Make sure you change the code to tstructline in ALL the
places you refer to it.


Quote:
> Here is the error message. Thanks for your help.

> Compiling...
> ScrollC.cpp
> d:\program files\microsoft visual studio\vc98\include\utility(21) : error
> C2558: struct 'tstuctLine' : no copy constructor available
>         d:\program files\microsoft visual studio\vc98\include\utility(21)
:
> while compiling class-template member function '__thiscall
> std::pair<unsigned int const ,struct tstuctLine>::std::pair<unsigned int
> const ,struct tstuctLine>(const unsigned
> int &,const tstuctLine &)'
> Error executing cl.exe.

> ScrollC.obj - 1 error(s), 0 warning(s)



> > Hmm, could you give us more information, including the full error
message
> > and the line of code that generates the error message?

> > I compiled the code (minus the MFC stuff) successfully on my machine...

> > Ken



> > > No. I cut and paste my code to this message, and hence the typo.
Sorry.

> > > However, the error is there with no typo.

> > > Thanks again.





> > > > > I am getting compile error when using template map. I try to use
map
> > > > > functionality, but got the compile error --
> > > CScrollC<double>::tstuctLine'
> > > > :
> > > > > no copy constructor available
> > > > <snip>
> > > > > typedef struct {
> > > > >  MAPDATA m_mapData;
> > > > >  int a, b;
> > > > > } tstructLine;

> > > > >  typedef map<UINT, tstuctLine> MAPLINE;

> > > > Pardon the obvious question, but is it related to the fact you're
> > missing
> > > an
> > > > 'r' in your map declaration?  tstuctLine -> tstructLine?

> > > > Or is that just a transcription error?

> > > > Ken



Wed, 29 Dec 2004 22:08:10 GMT  
 
 [ 12 post ] 

 Relevant Pages 

1. error - no copy constructor available

2. Need help on 'error C2558: ... : no copy constructor available'

3. Help! No copy constructor available

4. no copy constructor available

5. C2512 Error with ATL COM: no appropriate default constructor available

6. error C2512: no appropriate default constructor available

7. Error..CFileDialog' : no appropriate default constructor available

8. STL no copy constructor error

9. irritating CString copy constructor (?) error

10. copy constructor error

11. VC5.0: union member has copy constructor( error no C2621 )

12. Copy Constructor : Copying Base Class Member Variables

 

 
Powered by phpBB® Forum Software