Error Cannot Define Cppunit Ostringstream
que nous obtenions votre permission avant d'envoyer des cookies à votre navigateur Web.Notre site dépend de ces cookies pour fonctionner correctement.Si vous souhaitez continuer vers le site, nous supposerons que vous acceptez notre utilisation des cookies pour le bon fonctionnement de notre site et pour des publicités ciblées en fonction de vos intérêts. Pour en savoir plus, veuillez cliquer sur « Préférences de cookies » ci-dessous afin de définir vos préférences de cookies.Continuer vers le site
to the documentation of this file.00001 #ifndef CPPUNIT_PORTABILITY_STREAM_H_INCLUDED 00002 #define CPPUNIT_PORTABILITY_STREAM_H_INCLUDED 00003 00004 // This module define: 00005 // Type CppUT::Stream (either std::stream or a custom type) 00006 // Type CppUT::OStringStream (eitjer std::ostringstream, older alternate or a custom type) 00007 // Functions stdCOut() & stdCErr() which returns a reference on cout & cerr stream (or our 00008 // custom stream). 00009 00010 00011 #if defined( CPPUNIT_NO_STREAM ) 00012 00013 #include 00014 #include 00015 #include 00016 00017 CPPUNIT_NS_BEGIN 00018 00019 class StreamBuffer 00020 { 00021 public: 00022 virtual ~StreamBuffer() {} 00023 00024 virtual void write( const char *text, unsigned int length ) = 0; 00025 00026 virtual void flush() {} 00027 }; https://sourceforge.net/p/cppunit/mailman/message/6281220/ 00028 00029 00030 class StringStreamBuffer : public StreamBuffer 00031 { 00032 public: 00033 std::string str() const 00034 { 00035 return str_; 00036 } 00037 00038 public: // overridden from StreamBuffer 00039 void write( const char *text, unsigned int length ) 00040 { 00041 str_.append( text, length ); 00042 } 00043 00044 private: 00045 std::string str_; 00046 }; 00047 00048 00049 class FileStreamBuffer : public StreamBuffer 00050 { 00051 public: 00052 FileStreamBuffer( FILE *file ) http://cppunit.sourceforge.net/doc/cvs/_stream_8h-source.html 00053 : file_( file ) 00054 { 00055 } 00056 00057 FILE *file() const 00058 { 00059 return file_; 00060 } 00061 00062 public: // overridden from StreamBuffer 00063 void write( const char *text, unsigned int length ) 00064 { 00065 if ( file_ ) 00066 fwrite( text, sizeof(char), length, file_ ); 00067 } 00068 00069 void flush() 00070 { 00071 if ( file_ ) 00072 fflush( file_ ); 00073 } 00074 00075 private: 00076 FILE *file_; 00077 }; 00078 00079 00080 class OStream 00081 { 00082 public: 00083 OStream() 00084 : buffer_( 0 ) 00085 { 00086 } 00087 00088 OStream( StreamBuffer *buffer ) 00089 : buffer_( buffer ) 00090 { 00091 } 00092 00093 virtual ~OStream() 00094 { 00095 } 00096 00097 OStream &flush() 00098 { 00099 if ( buffer_ ) 00100 buffer_->flush(); 00101 return *this; 00102 } 00103 00104 void setBuffer( StreamBuffer *buffer ) 00105 { 00106 buffer_ = buffer; 00107 } 00108 00109 OStream &write( const char *text, unsigned int length ) 00110 { 00111 if ( buffer_ ) 00112 buffer_->write( text, length ); 00113 return *this; 00114 } 00115 00116 OStream &write( const char *text ) 00117 { 00118 return write( text, strlen(text) ); 00119 } 00120 00121 OStream &operator <<( bool v ) 00122 { 00123 const char *out = v
Fri, 17 Mar http://www.squid-cache.org/mail-archive/squid-users/200603/0537.html 2006 16:13:57 -0800 Henrik Nordstrom wrote: > Copy-pasted your configure http://cppunit.sourcearchive.com/documentation/1.10.2/Portability_8h-source.html line on my Fedora Core 5 test 3 x86_64 box, > and it compiles just fine.. --- Figures. > 1. Grab the current snapshot release. --- Ahead of you. Already done (squid-3.0-PRE3-200603017.tar.bz2). > 2. Start with just error cannot ./configure, without any arguments. --- Tried that too. The configure completes with no error message in either case. It's the "make" that follows that displays the error when it gets to cppunit. From the make I traced back to what it was complaining about: ... Making error cannot define all in cppunit make[4]: Entering directory `/home/tools/squid/work/lib/cppunit-1.10.0/src/cppunit' /bin/sh ../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I../../config -I../../include -I../../include -g -O2 -c -o AdditionalMessage.lo AdditionalMessage.cpp mkdir .libs g++ -DHAVE_CONFIG_H -I. -I. -I../../config -I../../include -I../../include -g -O2 -c AdditionalMessage.cpp -fPIC -DPIC -o .libs/AdditionalMessage.o In file included from ../../include/cppunit/Portability.h:10, from ../../include/cppunit/Message.h:4, from ../../include/cppunit/AdditionalMessage.h:4, from AdditionalMessage.cpp:1: ../../include/cppunit/config-auto.h:12:17: warning: extra tokens at end of #ifndef directive ...many of these... In file included from ../../include/cppunit/Message.h:4, from ../../include/cppunit/AdditionalMessage.h:4, from AdditionalMessage.cpp:1: ../../include/cppunit/Portability.h:205:5: #error Cannot define CppUnit::OStringStream. make[4]: *** [AdditionalMessage.lo] Error 1 make[4]: Leaving directory `/home/tools/squid/work/lib/cppunit-1.10.0/src/cppunit' make[3]: *** [all-recursive] Error 1 --- That traced back to what appears to be bogus code in 'config-auto.h'. What should that file look like, anyway? Seems like something in 'configure' should be producing it. > 3b, If a plain configure fails, dig into the config.log files to try to > i
Classes Files Directories cppunit-1.10.2»include»cppunit Portability.h#ifndef CPPUNIT_PORTABILITY_H #define CPPUNIT_PORTABILITY_H #if defined(_WIN32) && !defined(WIN32) # define WIN32 1 #endif /* include platform specific config */ #if defined(__BORLANDC__) # include #elif defined (_MSC_VER) # include #else # include #endif // Version number of package #ifndef CPPUNIT_VERSION #define CPPUNIT_VERSION "1.10.2" #endif #include // define CPPUNIT_API & CPPUNIT_NEED_DLL_DECL #include /* Options that the library user may switch on or off. * If the user has not done so, we chose default values. */ /* Define to 1 if you wish to have the old-style macros assert(), assertEqual(), assertDoublesEqual(), and assertLongsEqual() */ #if !defined(CPPUNIT_ENABLE_NAKED_ASSERT) # define CPPUNIT_ENABLE_NAKED_ASSERT 0 #endif /* Define to 1 if you wish to have the old-style CU_TEST family of macros. */ #if !defined(CPPUNIT_ENABLE_CU_TEST_MACROS) # define CPPUNIT_ENABLE_CU_TEST_MACROS 0 #endif /* Define to 1 if the preprocessor expands (#foo) to "foo" (quotes incl.) I don't think there is any C preprocess that does NOT support this! */ #if !defined(CPPUNIT_HAVE_CPP_SOURCE_ANNOTATION) # define CPPUNIT_HAVE_CPP_SOURCE_ANNOTATION 1 #endif /* Assumes that STL and CppUnit are in global space if the compiler does not support namespace. */ #if !defined(CPPUNIT_HAVE_NAMESPACES) # if !defined(CPPUNIT_NO_NAMESPACE) # define CPPUNIT_NO_NAMESPACE 1 # endif // !defined(CPPUNIT_NO_NAMESPACE) # if !defined(CPPUNIT_NO_STD_NAMESPACE) # define CPPUNIT_NO_STD_NAMESPACE 1 # endif // !defined(CPPUNIT_NO_STD_NAMESPACE) #endif // !defined(CPPUNIT_HAVE_NAMESPACES) /* Define CPPUNIT_STD_NEED_ALLOCATOR to 1 if you need to specify * the allocator you used when instantiating STL container. Typically * used for compi