now I get this:

c:\jd\log4cxx\simple\bar.h(15) : error C2819: type 'log4cxx::Logger' does not 
have an overloaded member 'operator ->'
        o:\lib\log4cxx-0.9.6\include\log4cxx\logger.h(51) : see declaration of 
'log4cxx::Logger'
c:\jd\log4cxx\simple\bar.h(15) : error C2227: left of '->debug' must point to 
class/struct/union


-----Original Message-----
From: Michael CATANZARITI [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 16, 2004 11:05 AM
To: Log4CXX User
Subject: Re: Problems With Documenation Examples


Hello,

the example called "My App" is not correct this a fix :

// file MyApp.cpp

#include "com/foo/bar.h"
using namespace com::foo;

// include log4cxx header files.
#include <log4cxx/logger.h>
#include <log4cxx/basicconfigurator.h>
using namespace log4cxx;
using namespace log4cxx::helpers;

// Define a static logger variable so that it references the
// Logger instance named "MyApp".
LoggerPtr logger = Logger::getLogger(_T("MyApp"));

int main(int argc, char **argv)
{
        int result = EXIT_SUCCESS;
        try
        {
                // Set up a simple configuration that logs on the console.
                BasicConfigurator::configure();

                logger->info(_T("Entering application."));
                Bar bar;
                bar.doIt();
                logger->info(_T("Exiting application."));
        }
        catch(Exception&)
        {
                result = EXIT_FAILURE;
        }

        return result;
}

----------------------------

// file <com/foo/bar.h>

#include <log4cxx/logger.h>

namespace com
{
        namespace foo
        {
                class Bar
                {
                        static log4cxx::LoggerPtr logger;

                public:
                        void doIt()
                        {
                                logger->debug(_T("Did it again!"));
                        }
                };
        };
};

----------------------------

// file bar.cpp

#include "com/foo/bar.h"

using namespace com::foo;
using namespace log4cxx;

log4cxx::LoggerPtr Bar::logger = Logger::getLogger(_T("com.foo.bar"));

----------------------------

Micha�l


Selon "Dahl, Jon" <[EMAIL PROTECTED]>:

> I'm trying to compile version 1 of the MyApp example in the 
> Configuration section in Introduction.html.
> 
> I'm running VS .NET 2000, compiling natively, non Unicode. lib version 
> 0.9.6.
> 
> When compiling for the first time, this is what the compiler outputs: 
> Compiling... mapp.cpp
> 
> o:\lib\log4cxx-0.9.6\include\log4cxx\helpers\tchar.h(273) : warning
> C4244: 'argument' : conversion from '__w64 int' to 'std::streamoff', 
> possible loss of data
> o:\lib\log4cxx-0.9.6\include\log4cxx\helpers\tchar.h(274) : warning
> C4244: 'argument' : conversion from '__w64 int' to 'int', possible 
> loss of data
> o:\lib\log4cxx-0.9.6\include\log4cxx\helpers\tchar.h(279) : warning
> C4244: 'argument' : conversion from '__w64 int' to 'std::streamoff', 
> possible loss of data
> c:\jd\log4cxx\simple\bar.h(9) : error C2146: syntax error : missing 
> ';' before identifier 'logger'
> c:\jd\log4cxx\simple\bar.h(9) : error C2653: 'Logger' : is not a class 
> or namespace name
> c:\jd\log4cxx\simple\bar.h(9) : error C2065: 'getLogger' : undeclared 
> identifier
> c:\jd\log4cxx\simple\bar.h(9) : error C2864: 'logger' : only const 
> static integral data members can be initialized inside a class or 
> struct
> c:\jd\log4cxx\simple\bar.h(9) : error C2501: 'com::foo::Bar::logger' :
> missing storage-class or type specifiers
> c:\jd\log4cxx\simple\mapp.cpp(28) : error C2061: syntax error :
> identifier 'Exception'
> c:\jd\log4cxx\simple\mapp.cpp(28) : error C2310: catch handlers must
> specify one type
> c:\jd\log4cxx\simple\mapp.cpp(33) : error C2317: 'try' block starting on
> line '19' has no catch handlers
> 
> Can anyone shed light on this?
> 
> Thanks
> 
> JD
> 


Reply via email to