CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2007
    Posts
    34

    What does synthesized method first required here mean?

    Hi Everyone.

    I'm getting a few messages like this from the gcc (version 4.1.2) compiler.

    [cc] /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_construct.h:81: note: synthesized method ‘mynamespace::MyClass::MyClass(const mynamespace::MyClass&)’ first required here

    I'm not sure what changed last or when these started as I have not been working in this code for a while and others have.

    From researching I think this is the compiler telling me when it is using a compiler generated function (copy constructor or assignment operator) but what is the reason for this "note"?

    It seems like there might some concern or the compile would not be telling me about it.

    Thanks for the help.

  2. #2
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: What does synthesized method first required here mean?

    Can't you figure it out based on the messages following the message you posted?
    There should be more information in the following lines i think.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  3. #3
    Join Date
    May 2011
    Posts
    4

    Re: What does synthesized method first required here mean?

    I think may be you are creating a class object something like this
    Class A{}; // which is non-copayable

    A a = A(); // That's why you be may error error as such.

    Try
    A a();

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured