[Libreoffice] [PATCH] fix cosv build

Tom Tromey tromey at redhat.com
Wed Aug 10 09:54:20 PDT 2011

I tried building LibreOffice with svn trunk gcc; though in this case the
bug seems to be a fairly generic include order problem.

The build dies in cosv with:

Compiling: cosv/source/strings/string.cxx
In file included from ../../inc/cosv/string.hxx:33:0,
                 from ../../inc/cosv/csv_precomp.h:39,
                 from ../inc/precomp.h:32,
                 from /home/tromey/Space/LibreOffice/bootstrap/clone/sdk/cosv/source/strings/string.cxx:29:
../../inc/cosv/stringdata.hxx: In instantiation of 'csv::StringData<CHAR>::StringData(const CHAR*, csv::StringData<CHAR>::size_type) [with CHAR = char, csv::StringData<CHAR>::size_type = long unsigned int]':
/home/tromey/Space/LibreOffice/bootstrap/clone/sdk/cosv/source/strings/string.cxx:75:17:   required from here
../../inc/cosv/stringdata.hxx:105:5: error: 'memcpy' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
/usr/include/string.h:44:14: note: 'void* memcpy(void*, const void*, size_t)' declared here, later in the translation unit
dmake:  Error code 1, while making '../../unxlngx6.pro/obj/string.obj'

string.hxx includes <string.h>, which declares memcpy, after
cosv/stringdata.hxx.  Moving <string.h> earlier fixes the problem.

This is contributed under the LGPLv3+/MPL.


diff --git a/cosv/inc/cosv/string.hxx b/cosv/inc/cosv/string.hxx
index 08b1220..8f249f9 100644
--- a/cosv/inc/cosv/string.hxx
+++ b/cosv/inc/cosv/string.hxx
@@ -30,9 +30,9 @@
+#include <string.h>
 #include <cosv/stringdata.hxx>
 #include <cosv/str_types.hxx>
-#include <string.h>
 #include <cosv/csv_ostream.hxx>
 #include <vector>

More information about the LibreOffice mailing list