RAD Studio |  |

E2171: Body has already been defined for function 'function' (C++)

A function with this name and type was previously supplied a function body.

A function body can only be supplied once.

One cause of this error is not declaring a default constructor which you implement. For example:

Copy Code

    class A {
    public:
       virtual myex();
    };
    A::A() {} // error

Having not seen you declare the default constructor in the class declaration, the compiler has had to generate one, thus giving the error message when it sees one. this is a correct example:

Copy Code

    class A {
    public:
       A();
       virtual myex();
    };
    A::A() {}

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!