class abc
{
public:
 virtual ~abc() {}
 static void operator delete(void*);
};
int main(int argc, char *argv[])
{
 abc _a;
 return 0;
}

where have you defined delete?

..because you failed to provide an implementation for the non-virtual function.

class abc
{
    public: virtual ~abc() {} 
    static void operator delete(void*) { /*do something*/}
};
int main(int argc, char *argv[])
{
    abc _a; return 0;
}
class abc{public: ~abc() {} static void operator delete(void*);};int main(int argc, char *argv[]){ abc _a; return 0;}

if change the ~abc() to novitual ,then ok,needn't define delete,why so?

you must be using a microsoft compiler (or a compiler with abi compatibility with the microsoft compiler). if the destructor is virtual, an entry needs to be made for the destructor in the vtbl of the class. for delete ptr_abc , two things need to happen.
a. the correct destructor must be called polymorphically
b. the appropriate operator delete must also be called polymorphically.
the microsoft technique is to synthesize a thunk (called the scalar deleting destructor) which does step a. followed by step b. and place the entry in the vtbl. so, you get a linker error (undefined external operator delete).
if the destructor is not virtual, no such thunk is required and therefore you do not get an error. (you will get the error only if you call delete).

in other compilers, the techniques used are different (and not as efficient). so, for instance in g++, you would not get a linker error unless you explicitly call delete somewhere.

for more information, see Stan Lippman's Inside the C++ Object Model (Addison-Wesley Professional, 1996)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.