(declared implicitly) cannot be referenced -- it is a deleted function

bryon 101 Reputation points
2023-01-06T18:49:45.29+00:00

Hello Everybody - So, I poked around for a bit on the error message in the title, and I think I have some understanding of what it is, but I do not have a resolution to the error;

Here is an idea of what I am working with:

struct A  
{  
  CByteArray array;  
  int x;  
  int y;  
  
  A()  
  {  
    x = 0;  
    y = 0;  
   }  
}  

void TestStruct(A a)  
{  
   //Do something  
}  

A a;
TestStruct(a);

When the struct 'object' is created, that is not a problem, however, when I go to pass it as a function variable, it comes up as an error

function "A::A(const A&)" (declared implicitly) cannot be referenced -- it is a deleted function

How can I get around this?

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,520 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Minxin Yu 9,866 Reputation points Microsoft Vendor
    2023-01-09T07:02:24.963+00:00

    Hi, @bryon

    The error is caused by CByteArray array

    Try adding A(const A& a)

    Best regards,

    Minxin Yu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.