You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Ambarish Mitra <am...@persistent.co.in> on 2006/07/18 11:40:35 UTC

warning: has virtual functions but non-virtual destructor

I have written a small application using log4cxx (log4cxx 0.9.7), the code
snippet is:

   string logpropertiesfile;
   logpropertiesfile="/home/ambarish/appl1/properties.txt";
   PropertyConfigurator::configure(logpropertiesfile);


LOG4CXX_INFO(logger,"================================Initialized============
=====================");


When I compile with g++ -Wall (g++ 3.4.5), I get a lot of warning, all of
the form:


/home/ambarish/log4cxx/include/log4cxx/helpers/class.h:53: warning: `class
log4cxx::helpers::Class' has virtual functions but non-virtual destructor
....
....


Can anyone please provide pointers why these warnings comes? I would think
this is a basic thing in CPP, a class with virtual functions should have a
virtual destructor, otherwise there is a chance of memory leak. Is there a
way to solve this problem from the application perspective?


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

Re: warning: has virtual functions but non-virtual destructor

Posted by Curt Arnold <ca...@apache.org>.
On Jul 18, 2006, at 4:40 AM, Ambarish Mitra wrote:

> I have written a small application using log4cxx (log4cxx 0.9.7),  
> the code
> snippet is:
>
>

....

> Can anyone please provide pointers why these warnings comes? I  
> would think
> this is a basic thing in CPP, a class with virtual functions should  
> have a
> virtual destructor, otherwise there is a chance of memory leak. Is  
> there a
> way to solve this problem from the application perspective?
>


Please use the SVN HEAD instead of log4cxx-0.9.7.  Many significant  
bugs have been fixed in the SVN in addition to ~Class being virtual.