You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to set up GoogleTest under CppUTest framework in order to support parameterized tests (https://groups.google.com/g/cpputest/c/FuPTZm5_nqg). So I followed the description from the manual (https://cpputest.github.io/manual.html#gtest), but it failed to compile even for only the easiest TEST_GROUP HelloWorld in the example directory in CppUTest. I got stuck in the error:
compiling AllTests.cpp
In file included from /usr/local/include/gtest/internal/gtest-port.h:271:0,
from /usr/local/include/gtest/internal/gtest-internal.h:40,
from /usr/local/include/gtest/gtest.h:62,
from ../include/CppUTestExt/GTest.h:37,
from ../include/CppUTestExt/GTestConvertor.h:95,
from AllTests/AllTests.cpp:34:
/usr/include/c++/7/sstream:300:7: error: ‘struct std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>::__xfer_bufptrs’ redeclared with different access
struct __xfer_bufptrs
^~~~~~
compilation terminated due to -Wfatal-errors.
After a little bit of explorations about the problem, I guessed that this problem seemed to be caused by the #define access hack in the include/CppUTestExt/GTestConvertor.h: 92 #define private public #define protected public
which makes the __xfer_bufptrs public, but it is defined as private in class basic_stringbuf. The action of #define access hack maybe cause the problem in GoogleTest because that GoogleTest used sstream (Not sure, just as my guess...).
I have tried some suggestions from others discussions, ex: changing the #include order in examples/AllTests/AllTests.cpp, but it doesn't work (which make sense in my opinion). something like:
#include "CppUTest/CommandLineTestRunner.h"
#include "CppUTest/TestPlugin.h"
#include "CppUTest/TestRegistry.h"
#include "CppUTestExt/IEEE754ExceptionsPlugin.h"
#include "CppUTestExt/MockSupportPlugin.h"
#include "CppUTestExt/GTestConvertor.h" // <-- changing this one up or down
I also tried to use some more ugly hacks like #undef private #define private private
somewhere in GTestConvertor.h, but I still failed.
I would like to know what should I do to handle this problem?
git clone https://github.com/google/googletest.git -b release-1.12.1
cd googletest # Main directory of the cloned repository.
mkdir build # Create a directory to hold the build output.
cd build
cmake .. # Generate native build scripts for GoogleTest.
Yes, at the moment, we've only tested CppUTest with max gtest 1.8. @thetic was checking if he can also get other version to work (and add it to the CppUTest automated build) but I suspect it might still need some work.
I was able to work around this by building with gtest 1.8 and C++ 98. I'm starting to doubt that this can be made to work reliably across gtest and C++ versions.
I tried to set up GoogleTest under CppUTest framework in order to support parameterized tests (https://groups.google.com/g/cpputest/c/FuPTZm5_nqg). So I followed the description from the manual (https://cpputest.github.io/manual.html#gtest), but it failed to compile even for only the easiest TEST_GROUP HelloWorld in the example directory in CppUTest. I got stuck in the error:
After a little bit of explorations about the problem, I guessed that this problem seemed to be caused by the #define access hack in the include/CppUTestExt/GTestConvertor.h: 92
#define private public
#define protected public
which makes the __xfer_bufptrs public, but it is defined as private in class basic_stringbuf. The action of #define access hack maybe cause the problem in GoogleTest because that GoogleTest used sstream (Not sure, just as my guess...).
I have tried some suggestions from others discussions, ex: changing the #include order in examples/AllTests/AllTests.cpp, but it doesn't work (which make sense in my opinion). something like:
I also tried to use some more ugly hacks like
#undef private
#define private private
somewhere in GTestConvertor.h, but I still failed.
I would like to know what should I do to handle this problem?
Some refs:
Not sure if these helps:
The text was updated successfully, but these errors were encountered: