When I build log4cpp-0.3.5rc2 in cygwin and fedora core
1, It ocurred error , error is :
make[1]: Entering directory
`/cygdrive/d/cdev/cygwin/log4cpp-0.3.5rc2/src'
if /bin/bash ../libtool --tag=CXX --mode=compile g++
-DHAVE_CONFIG_H -I. -I. -I../include -I../include -g
-O2 -Wall -Wno-u
nused -pedantic -MT FileAppender.lo -MD -MP -MF
".deps/FileAppender.Tpo" -c -o FileAppender.lo
FileAppender.cpp; \
then mv -f ".deps/FileAppender.Tpo"
".deps/FileAppender.Plo"; else rm -f
".deps/FileAppender.Tpo"; exit 1; fi
g++ -DHAVE_CONFIG_H -I. -I. -I../include -I../include
-g -O2 -Wall -Wno-unused -pedantic -MT FileAppender.lo
-MD -MP -MF .de
ps/FileAppender.Tpo -c FileAppender.cpp -DPIC -o
.libs/FileAppender.o
In file included from ../include/log4cpp/Category.hh:17,
from FileAppender.cpp:21:
../include/log4cpp/CategoryStream.hh:19:34:
log4cpp/Manipulator.hh: No such file or directory
In file included from ../include/log4cpp/Category.hh:17,
from FileAppender.cpp:21:
../include/log4cpp/CategoryStream.hh:110: error:
expected unqualified-id before '&' token
../include/log4cpp/CategoryStream.hh:110: error:
expected `,' or `...' before '&' token
../include/log4cpp/CategoryStream.hh:110: error: ISO
C++ forbids declaration of `parameter' with no type
../include/log4cpp/CategoryStream.hh:133: error:
using-declaration for non-member at class scope
../include/log4cpp/CategoryStream.hh:133: error:
expected `;' before '*' token
../include/log4cpp/CategoryStream.hh: In member
function `log4cpp::CategoryStream&
log4cpp::CategoryStream::operator<<(int)':
../include/log4cpp/CategoryStream.hh:112: error:
`_wbuffer' undeclared (first use this function)
../include/log4cpp/CategoryStream.hh:112: error: (Each
undeclared identifier is reported only once for each
function it appea
rs in.)
../include/log4cpp/CategoryStream.hh:113: error:
`std::wostringstream' has not been declared
../include/log4cpp/CategoryStream.hh:117: error: `t'
undeclared (first use this function)
make[1]: *** [FileAppender.lo] Error 1
make[1]: Leaving directory
`/cygdrive/d/cdev/cygwin/log4cpp-0.3.5rc2/src'
make: *** [all-recursive] Error 1
I think you include error file :log4cpp/Manipulator.hh
my gcc is :
$ gcc -v
Reading specs from /usr/lib/gcc/i686-pc-cygwin/3.4.4/specs
Configured with: /gcc/gcc-3.4.4/gcc-3.4.4-1/configure
--verbose --prefix=/usr --exec-prefix=/usr
--sysconfdir=/etc --libdir=/
usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info
--enable-languages=c,ada,c++,d,f77,java,objc
--enable-nls --without-included-gettext
--enable-version-specific-runtime-libs --without-x
--enable-libgcj --disable-java-awt
--with-system-zlib --enable-interpreter
--disable-libgcj-debug --enable-threads=posix
--enable-java-gc=boehm --disable-win32
-registry --enable-sjlj-exceptions
--enable-hash-synchronization --enable-libstdcxx-debug
: (reconfigured)
Thread model: posix
gcc version 3.4.4 (cygming special) (gdc 0.12, using
dmd 0.125)
Logged In: NO
I have absolutely the same error.
Development environment: MinGW-gcc 3.4.4 (generaly hand-
made, based on MinGW-3.2.0-rc-3 + MSYS-1.0.11-2004.04.30-1 +
msysDTK-1.0.1 + gcc-*-3.4.4-20050522 + binutils-2.16.91-
20050827-1 + make 3.79.1 + Msys Developer + ...)
I managed to compile library, using some quick hacks:
<path>/log4cpp-0.3.5rc3/include/log4cpp/Manipulator.hh :
My compiler dislikes last semicolon in the file... Semicolon
removed
27: friend LOG4CPP_EXPORT std::ostream& operator<< (std::
ostream& os, const tab& w);
28: };
29: } //<= here was semicolon
30: #endif
<path>/log4cpp-0.3.5rc3/include/log4cpp/CategorStream.hh:
It looks like MinGW do not (at least easily) supports wide
streams, so "wostringstream" is absent, so I commented out
corresponding lines in CategorStream.hh
//101: template<typename T> CategoryStream&
operator<<(const std::wstring& t) {
// if (getPriority() != Priority::NOTSET) {
// if (!_wbuffer) {
// if (!(_wbuffer = new std::
wostringstream)) {
// // XXX help help help
// }
// }
// (*_wbuffer) << t;
// }
// return *this;
// }
<* skipped *>
//113: std::wostringstream* _wbuffer;
<* skipped *>
<path>/log4cpp-0.3.5rc3/include/log4cpp/
RemoteSyslogAppender.hh :
Superfluous commas in lines 36 and 61
typedef enum {
LOG_EMERG = 0, ///< system is unusable
LOG_ALERT = 1, ///< action must be taken
immediately
LOG_CRIT = 2, ///< critical conditions
LOG_ERR = 3, ///< error conditions
LOG_WARNING = 4, ///< warning conditions
LOG_NOTICE = 5, ///< normal but significant
condition
LOG_INFO = 6, ///< informational
LOG_DEBUG = 7 //<= here was a comma (line36, can
it be compilled at all, using any compiler???? ) ///<
debug-level messages
} SyslogLevel;
<* skipped *>
LOG_LOCAL7 = (23<<3) //<= here was a comma ///<
reserved for local use
} SyslogFacility;
And, because portability system, icluding Portability.hh is
not aware about MinGW, I had to add definition of in_addr_t
(just a hack):
#ifdef WIN32
#include <winsock2.h>
+typedef unsigned long in_addr_t;
#else
<path>/log4cpp-0.3.5rc3/include/log4cpp/Priority.hh:
The same problem and the same hack
#include <log4cpp/Portability.hh>
+#ifdef WIN32
+#ifndef LOG4CPP_FIX_ERROR_COLLISION
+#define LOG4CPP_FIX_ERROR_COLLISION 1
+#endif
+#endif
#include <string>
#include <stdexcept>
It looks like portability system needs some redesign to
include MinGW, without disrupting build process and so on
for other platforms (my modifications almost certainly do
it) .
Then
./configure
make
Compilation of tests/Clock.cpp fails because "gettimeofday"
is used without looking in with config.h (It does not check
LOG4CPP_HAVE_GETTIMEOFDAY)
make install
That was enough for me to compile adn install the library.
Best regards, Indrekis
indrekis at icmp.lviv.ua
PS. Please excuse my English...