Hello all, I'm trying to load/save protobuf format data directly in R, so writing a R external function in C++. As visual studio doesn't support this usage, I have to compile the code with Rtools (which is essentially mingw and cygwin). However, when I try to compile it, I receive an error because of including the protobuf header.
C:\t>R CMD SHLIB test.cpp g++ -I"C:/PROGRA~1/R/R-211~1.1/include" -O2 -Wall -c test.cpp -o test.o In file included from c:\rtools\mingw\bin\../lib/gcc/mingw32/4.2.1- sjlj/include/c++/bits/locale_facets.h:1536, from c:\rtools\mingw\bin\../lib/gcc/mingw32/4.2.1- sjlj/include/c++/bits/basic_ios.h:44, from c:\rtools\mingw\bin\../lib/gcc/mingw32/4.2.1- sjlj/include/c++/ios:50, from c:\rtools\mingw\bin\../lib/gcc/mingw32/4.2.1- sjlj/include/c++/ostream:45, from c:\rtools\mingw\bin\../lib/gcc/mingw32/4.2.1- sjlj/include/c++/iterator:70, from C:/PROGRA~1/R/R-211~1.1/include/google/protobuf/ repeated_field.h:50, from Person.pb.h:23, from test.cpp:5: c:\rtools\mingw\bin\../lib/gcc/mingw32/4.2.1-sjlj/include/c++/bits/ codecvt.h:219:45: error: macro "length" passed 4 arguments, but takes just 1 test.cpp:108:4: warning: no newline at end of file In file included from c:\rtools\mingw\bin\../lib/gcc/mingw32/4.2.1- sjlj/include/c++/bits/locale_facets.h:1536, from c:\rtools\mingw\bin\../lib/gcc/mingw32/4.2.1- sjlj/include/c++/bits/basic_ios.h:44, from c:\rtools\mingw\bin\../lib/gcc/mingw32/4.2.1- sjlj/include/c++/ios:50, from c:\rtools\mingw\bin\../lib/gcc/mingw32/4.2.1- sjlj/include/c++/ostream:45, from c:\rtools\mingw\bin\../lib/gcc/mingw32/4.2.1- sjlj/include/c++/iterator:70, from C:/PROGRA~1/R/R-211~1.1/include/google/protobuf/ repeated_field.h:50, from Person.pb.h:23, from test.cpp:5: c:\rtools\mingw\bin\../lib/gcc/mingw32/4.2.1-sjlj/include/c++/bits/ codecvt.h:218: error: expected ';' before 'const' c:\rtools\mingw\bin\../lib/gcc/mingw32/4.2.1-sjlj/include/c++/bits/ codecvt.h:222: error: expected `;' before 'int' In file included from Person.pb.h:24, from test.cpp:5: C:/PROGRA~1/R/R-211~1.1/include/google/protobuf/extension_set.h:450: error: expected identifier before '(' token C:/PROGRA~1/R/R-211~1.1/include/google/protobuf/extension_set.h:450: error: expected `)' before ',' token test.cpp: In function 'void cpp_test(int*, double*, double*, int*, double*, double*)': make: *** [test.o] Error 1 The code in codecvt.h:219:45 is : int length(state_type& __state, const extern_type* __from, const extern_type* __end, size_t __max) const { return this->do_length(__state, __from, __end, __max); } The code in include/google/protobuf/extension_set.h:450 is: int GetSize() const; void Free(); int SpaceUsedExcludingSelf() const; I'm using windows xp sp3, protobuf 2.3.0, g++ (GCC) 4.2.1-sjlj (mingw32-2), R version 2.11.1. I suspect the reason that protobuf is just not compatible with g++ version 4.2.1 or the g++ in Rtools is somewhat downgraded version of full g++, thus does not match with protobuf. Does anyone have same issues / know how to fix this? Thank you! -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.