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 Thorsten Schöning <ts...@am-soft.de> on 2010/06/07 17:34:33 UTC

Re: error while linking with std::basic_string<...>::basic_string<...>(...)

Guten Tag Thorsten Schöning,
am Montag, 31. Mai 2010 um 16:15 schrieben Sie:

> [Linker Fehler] Unresolved external 'std::basic_string<char,
> std::char_traits<char>, std::allocator<char> >::basic_string<char,
> std::char_traits<char>, std::allocator<char> >(int, int, const
> std::allocator<char>&)' referenced from
> D:\BENUTZER\TSCHOENING\EIGENE
> DATEIEN\BIBLIOTHEKEN\TRUNK\C++\LOG4CXX\SRC\MAIN\CPP\PROJECT1.LIB|cacheddateformat

In case anyone else is bound to an old Borland, like us: The problem
occurs where variables of type LogString are constructed with numeric
characters. Borland doesn't interpret the provided hex codes to be a
wchar_t, like Visual Studio seems to do. There are only a few
statements that were responsible for our error and after changing them
to use the macro and LOG4CXX_STR everything seems to work now. I don't
understand why hex codes are used anyway, because some places have the
character meaning commented right after.

Our changes:

Index: D:/Benutzer/tschoening/Eigene Dateien/Bibliotheken/trunk/C++/log4cxx/src/main/cpp/syslogappender.cpp
===================================================================
--- D:/Benutzer/tschoening/Eigene Dateien/Bibliotheken/trunk/C++/log4cxx/src/main/cpp/syslogappender.cpp        (Revision 1277)
+++ D:/Benutzer/tschoening/Eigene Dateien/Bibliotheken/trunk/C++/log4cxx/src/main/cpp/syslogappender.cpp        (Revision 1278)
@@ -285,7 +285,7 @@
                 return;
         }
 
-        LogString sbuf(1, 0x3C /* '<' */);
+        LogString sbuf(1, LOG4CXX_STR('<'));
         StringHelper::toString((syslogFacility | event->getLevel()->getSyslogEquivalent()), p, sbuf);
         sbuf.append(1, (logchar) 0x3E /* '>' */);
         if (facilityPrinting)
Index: D:/Benutzer/tschoening/Eigene Dateien/Bibliotheken/trunk/C++/log4cxx/src/main/cpp/telnetappender.cpp
===================================================================
--- D:/Benutzer/tschoening/Eigene Dateien/Bibliotheken/trunk/C++/log4cxx/src/main/cpp/telnetappender.cpp        (Revision 1277)
+++ D:/Benutzer/tschoening/Eigene Dateien/Bibliotheken/trunk/C++/log4cxx/src/main/cpp/telnetappender.cpp        (Revision 1278)
@@ -178,7 +178,7 @@
                     write(buf);
                     buf.clear();
                     if (CharsetEncoder::isError(stat)) {
-                        LogString unrepresented(1, 0x3F /* '?' */);
+                        LogString unrepresented(1, LOG4CXX_STR('?'));
                         LogString::const_iterator unrepresentedIter(unrepresented.begin());
                         stat = encoder->encode(unrepresented, unrepresentedIter, buf);
                         buf.flip();
Index: D:/Benutzer/tschoening/Eigene Dateien/Bibliotheken/trunk/C++/log4cxx/src/main/cpp/cacheddateformat.cpp
===================================================================
--- D:/Benutzer/tschoening/Eigene Dateien/Bibliotheken/trunk/C++/log4cxx/src/main/cpp/cacheddateformat.cpp      (Revision 1277)
+++ D:/Benutzer/tschoening/Eigene Dateien/Bibliotheken/trunk/C++/log4cxx/src/main/cpp/cacheddateformat.cpp      (Revision 1278)
@@ -42,7 +42,7 @@
 /**
  *  Expected representation of first magic number.
  */
-const logchar CachedDateFormat::magicString1[] = { 0x36, 0x35, 0x34, 0 };
+const LogString CachedDateFormat::magicString1 = LOG4CXX_STR("654");
 
 
 /**
@@ -71,7 +71,7 @@
        formatter(dateFormat),
        millisecondStart(0),
        slotBegin(std::numeric_limits<log4cxx_time_t>::min()),
-       cache(50, 0x20),
+       cache(50, LOG4CXX_STR(' ')),
        expiration(expiration1),
        previousTime(std::numeric_limits<log4cxx_time_t>::min()) {
   if (dateFormat == NULL) {
Index: D:/Benutzer/tschoening/Eigene Dateien/Bibliotheken/trunk/C++/log4cxx/src/main/include/log4cxx/helpers/cacheddateformat.h
===================================================================
--- D:/Benutzer/tschoening/Eigene Dateien/Bibliotheken/trunk/C++/log4cxx/src/main/include/log4cxx/helpers/cacheddateformat.h    (Revision 1277)
+++ D:/Benutzer/tschoening/Eigene Dateien/Bibliotheken/trunk/C++/log4cxx/src/main/include/log4cxx/helpers/cacheddateformat.h    (Revision 1278)
@@ -62,7 +62,7 @@
               /**
                *  Expected representation of first magic number.
                */
-              static const logchar magicString1[];
+              static const LogString magicString1;
 
 
               /**

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning
AM-SoFT IT-Systeme - Hameln | Potsdam | Leipzig
 
Telefon: Potsdam: 0331-743881-0
E-Mail:  tschoening@am-soft.de
Web:     http://www.am-soft.de

AM-SoFT GmbH IT-Systeme, Konsumhof 1-5, 14482 Potsdam
Amtsgericht Potsdam HRB 21278 P, Geschäftsführer: Andreas Muchow


Re: error while linking with std::basic_string<...>::basic_string<...>(...)

Posted by Thorsten Schöning <ts...@am-soft.de>.
Guten Tag Curt Arnold,
am Dienstag, 8. Juni 2010 um 05:08 schrieben Sie:

> The hex codes were intentional since they would give the expected
> character value even if compiled using a non-ASCII based encoding like EBCDIC.

Isn't this case already handled by the following in logstring.h?

#if LOG4CXX_CHARSET_EBCDIC
#define LOG4CXX_STR(str) log4cxx::helpers::Transcoder::decode(str)

> I'll try to pull the constants out into preprocessor macros and do a little #if(__BORLANDC__)

Thanks, that would be great!

We found two changes where not necessary:

Index: D:/Benutzer/tschoening/Eigene Dateien/Bibliotheken/trunk/C++/log4cxx/src/main/cpp/cacheddateformat.cpp
===================================================================
--- D:/Benutzer/tschoening/Eigene Dateien/Bibliotheken/trunk/C++/log4cxx/src/main/cpp/cacheddateformat.cpp      (Revision 1278)
+++ D:/Benutzer/tschoening/Eigene Dateien/Bibliotheken/trunk/C++/log4cxx/src/main/cpp/cacheddateformat.cpp      (Revision 1279)
@@ -42,7 +42,7 @@
 /**
  *  Expected representation of first magic number.
  */
-const LogString CachedDateFormat::magicString1 = LOG4CXX_STR("654");
+const logchar CachedDateFormat::magicString1[] = { 0x36, 0x35, 0x34, 0 };
 
 
 /**
Index: D:/Benutzer/tschoening/Eigene Dateien/Bibliotheken/trunk/C++/log4cxx/src/main/include/log4cxx/helpers/cacheddateformat.h
===================================================================
--- D:/Benutzer/tschoening/Eigene Dateien/Bibliotheken/trunk/C++/log4cxx/src/main/include/log4cxx/helpers/cacheddateformat.h    (Revision 1278)
+++ D:/Benutzer/tschoening/Eigene Dateien/Bibliotheken/trunk/C++/log4cxx/src/main/include/log4cxx/helpers/cacheddateformat.h    (Revision 1279)
@@ -62,7 +62,7 @@
               /**
                *  Expected representation of first magic number.
                */
-              static const LogString magicString1;
+              static const logchar magicString1[];
 
 
               /**

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning
AM-SoFT IT-Systeme - Hameln | Potsdam | Leipzig
 
Telefon: Potsdam: 0331-743881-0
E-Mail:  tschoening@am-soft.de
Web:     http://www.am-soft.de

AM-SoFT GmbH IT-Systeme, Konsumhof 1-5, 14482 Potsdam
Amtsgericht Potsdam HRB 21278 P, Geschäftsführer: Andreas Muchow


Re: error while linking with std::basic_string<...>::basic_string<...>(...)

Posted by Curt Arnold <ca...@apache.org>.
The hex codes were intentional since they would give the expected character value even if compiled using a non-ASCII based encoding like EBCDIC.

I'll try to pull the constants out into preprocessor macros and do a little #if(__BORLANDC__)