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

From RAD Studio
Jump to: navigation, search

Go Up to Compiler Errors And Warnings (C++) Index

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:

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:

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