Ok, digging deeper into the library I see LoggerPtr is an ObjPtr and not a true 
pointer.

Thanks.



----- Original Message ----
From: Stephen Bartnikowski <[EMAIL PROTECTED]>
To: Log4CXX User <log4cxx-user@logging.apache.org>
Sent: Friday, September 12, 2008 12:16:39 PM
Subject: RE: Forward Declaration

 
Somebody correct me if I'm wrong, but I don't think it will. In Test.hpp, 
the compiler doesn't know what type LoggerPtr is. Since you're referring to 
that 
type directly rather than by a pointer, the compiler needs to know the full 
details. It doesn't know that in reality it's a pointer type defined elsewhere. 
If for example, your code instead read:
 
...
class Test {
private:
    static log4cxx::LoggerPtr* 
_logger;
...
 
then the compiler wouldn't complain.
 
- 
Stephen


________________________________
 From: Jon Dahl [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 12, 2008 12:01 PM
To: log4cxx-user@logging.apache.org
Subject: Forward  Declaration


Hello,

I'm wondering if it is possible to use forward declaration  with log4cxx 
classes in a class header file. I would like to exclude the  log4cxx headers 
files in my header files if possible and include the log4cxx  header files in 
my cpp(source) files.

Should this work?

//  Test.hpp
namespace log4cxx {
class LoggerPtr;
}

class Test  {
private:
    static log4cxx:LoggerPtr     _logger;

public:
     Test();
};

//Test.cpp

#include  <log4cxx/logger.h>

using namespace log4cxx;

LoggerPtr  Test::_logger(Logger::getRootLogger());

Test::Test() {
}

//  end 
test.cpp

Thanks,

-jd-


      

Reply via email to