So actually you recommend to obtain the latest addition from SVN? I'll give it a shot.
Thank you! -----Original Message----- From: Curt Arnold [mailto:[EMAIL PROTECTED] Sent: Wed 3/7/2007 20:27 To: Log4CXX User Subject: Re: compile errors using LOG4CXX_DEBUG On Mar 7, 2007, at 10:14 AM, jorrit de vries wrote: > Hello, > > I get the following errors every time I use the LOG4CXX_DEBUG macro. > > I use the following syntax: > LOG4CXX_DEBUG(logger, "Switching to tool " + (*m_currentTool)->name); > > where 'logger' is defined in the class as: > static LoggerPtr logger; > > This is the part of the build log I get for the line above: > error C2589: ',' : illegal token on right side of '::' > error C2143: syntax error : missing ')' before '::' > error C2661: 'log4cxx::Logger::forcedLog' : no overloaded function > takes 0 arguments > error C2059: syntax error : ')' > > Can anybody point me to what I am doing wrong and how I might > prevent this error? > > Best regards, > Jorrit > log4cxx-0.9.7 is not recommended due to many issues that have been corrected in the SVN. I had hoped to package a new release in the last month or so, but log4j issues kept that from happening. The LOG4CXX_DEBUG macros are defined differently in 0.9.7 and the current SVN head. In 0.9.7, the second argument is a fragment of a stream statement, #define LOG4CXX_DEBUG(logger, message) { \ if (logger->isDebugEnabled()) {\ ::log4cxx::StringBuffer oss; \ oss << message; \ logger->forcedLog(::log4cxx::Level::DEBUG, oss.str(), __FILE__, __LINE__); }} So the message parameter needs to be such that oss << message; results in a valid statement. So if you did LOG4CXX_DEBUG(logger, "Switching to tool"); or LOG4CXX_DEBUG(logger, "Switching to tool " << (*m_currentTool)->name); you should be okay. However: LOG4CXX_DEBUG(logger, "Switching to tool " + (*m_currentTool)->name); isn't going to work since there is likely not a matching operator+. In the current SVN HEAD, #define LOG4CXX_DEBUG(logger, message) { \ if (LOG4CXX_UNLIKELY(logger->isDebugEnabled())) {\ logger->forcedLog(::log4cxx::Level::getDebug(), message, LOG4CXX_LOCATION); }} the message parameter needs to be match one of the prototypes for forcedLog (currently std::string or std::wstring). So you could likely do: LOG4CXX_DEBUG(logger, std::string("Switching to tool") + (*m_currentTool)->name); which should also work for log4cxx 0.9.7.
<<winmail.dat>>
