Closed wookietreiber closed 9 years ago
This error occurs on an up-to-date Arch Linux with both gcc 5.1.0 and clang 3.6.1. Note that on a CentOS 6 with gcc 4.9.2 there is no error.
After enabling the verbose mode I think I know what the problem is:
With clang:
$ make V=1 check
...
clang++ -DHAVE_CONFIG_H -I. -Dprotected=public -Dprivate=public -DJSON_IS_AMALGAMATION=1 -D_FORTIFY_SOURCE=2 -std=c++0x -g -O3 -I./unit_tests/gtest/include -I./unit_tests -I./include -std=c++0x -march=native -mfpmath=sse -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -MT unit_tests/bin_test_all-test_main.o -MD -MP -MF unit_tests/.deps/bin_test_all-test_main.Tpo -c -o unit_tests/bin_test_all-test_main.o `test -f 'unit_tests/test_main.cc' || echo './'`unit_tests/test_main.cc
In file included from unit_tests/test_main.cc:20:
In file included from ./unit_tests/gtest/gtest.h:308:
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../include/c++/5.1.0/sstream:335:14: error: '__xfer_bufptrs' redeclared with 'public' access
struct __xfer_bufptrs
^
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../include/c++/5.1.0/sstream:67:14: note: previously declared 'private' here
struct __xfer_bufptrs;
^
1 error generated.
Makefile:1264: recipe for target 'unit_tests/bin_test_all-test_main.o' failed
...
With gcc:
$ make V=1 check
...
g++ -DHAVE_CONFIG_H -I. -Dprotected=public -Dprivate=public -DJSON_IS_AMALGAMATION=1 -D_FORTIFY_SOURCE=2 -std=c++0x -g -O3 -I./unit_tests/gtest/include -I./unit_tests -I./include -std=c++0x -march=native -mfpmath=sse -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -MT unit_tests/bin_test_all-test_main.o -MD -MP -MF unit_tests/.deps/bin_test_all-test_main.Tpo -c -o unit_tests/bin_test_all-test_main.o `test -f 'unit_tests/test_main.cc' || echo './'`unit_tests/test_main.cc
In file included from ./unit_tests/gtest/gtest.h:308:0,
from unit_tests/test_main.cc:20:
/usr/include/c++/5.1.0/sstream:335:7: error: ‘struct std::basic_stringbuf<_CharT, _Traits, _Alloc>::__xfer_bufptrs’ redeclared with different access
struct __xfer_bufptrs
^
Makefile:1264: recipe for target 'unit_tests/bin_test_all-test_main.o' failed
Why is this set in Makefile.am
:
bin_test_all_CPPFLAGS = -Dprotected=public -Dprivate=public -DJSON_IS_AMALGAMATION=1
I think, this rewrites somehow the stuff from the std c++ lib.
Hi,
this -Dprivate=public
was a kludge I used at one point to test private methods of some of my classes. It always looked bad to me and it is not used anymore. I had forgotten that these flags were still in the Makefile.am.
It is fixed in the development branch. I'll make a new bugfix release tomorrow if nothing else comes up.
Thank you for the bug report.