On Sat, 2007-08-11 at 23:06 +0200, Serassio Guido wrote:
> Hi,
>
> Trying to build the current Squid 3 source using Visual Studio 2005
> on Windows, I get the following error.
> Any C++ suggestion ?
>
> Compiling...
> mem.cc
> c:\work\nt-3.0\src\StoreEntryStream.h(119) : error C2512:
> 'std::basic_ostream<_Elem,_Traits>' : no appropriate default
> constructor available
> with
> [
> _Elem=char,
> _Traits=std::char_traits<char>
> ]
This is with the code recently synced with HEAD, right?
Please try the attached untested patch. It follows the suggestions at
the page found by Amos:
http://www.codecomments.com/archive292-2005-2-396222.html
> Thanks for the link, but, I have really understand nothing .... :-(
> Really I hate C++ :-(
Is it a good idea to hate something you do not understand? :-)
Alex.
std::ostream may not have a default constructor on Windows so we need
to supply a NULL buffer and then change the buffer to ours.
Index: src/StoreEntryStream.h
===================================================================
RCS file: /cvsroot/squid/squid3/src/StoreEntryStream.h,v
retrieving revision 1.4
diff -u -r1.4 StoreEntryStream.h
--- src/StoreEntryStream.h 7 Aug 2007 20:02:51 -0000 1.4
+++ src/StoreEntryStream.h 13 Aug 2007 16:41:26 -0000
@@ -116,7 +116,11 @@
public:
/* create a stream for writing text etc into theEntry */
- StoreEntryStream(StoreEntry *entry): theBuffer(entry) { this->init(&theBuffer); }
+ // See http://www.codecomments.com/archive292-2005-2-396222.html
+ StoreEntryStream(StoreEntry *entry): std::ostream(0), theBuffer(entry) {
+ rdbuf(&theBuffer); // set the buffer to now-initialized theBuffer
+ clear(); //clear badbit set by calling init(0)
+ }
private:
StoreEntryStreamBuf theBuffer;