Reputation: 37
The code is compiling fine in VS2015 but in VS2019 code is throwing errors for CPPUNIT. Is it not supported in C++17 std? if not how to resolve these error:
Code:
class CAbcTestCase : public CppUnit::TestCase
{
CPPUNIT_TEST_SUITE(CAbcTestCase);
CPPUNIT_TEST(AbcThruRMB);
CPPUNIT_TEST(AbcMultiThruRMB);
CPPUNIT_TEST(AbcFolderThruRMB);
CPPUNIT_TEST(AbcUseFileThruRMB);
........
........
//CPPUNIT_TEST(Abc_UpdateRegistry);
CPPUNIT_TEST(Abc_Initialize);
**CPPUNIT_TEST_SUITE_END();** // *This line has all the below mentioned errors*
}
CPPUNIT error:
Error C2039 'auto_ptr': is not a member of 'std'
Error C2065 'auto_ptr': undeclared identifier.
Error C2660 'CHistoryTestCase::suite': function does not take 1 arguments
Error C2275 'CppUnit:: TestSuite': illegal use of this type as an expression
Error (active) E0135 namespace "std" has no member "auto_ptr"
Upvotes: 1
Views: 534
Reputation: 238491
Does std C++17 does not support CPPUNIT?
You've got the relation backwards. It is the program that has to be compatible with the programming language. So, the question is, does (this version of) CPPUNIT work with C++17?
Based on the error, if CPPUNIT does indeed use std::auto_ptr
, then it isn't C++17 compatible, because that class was removed from the standard library.
That said, perhaps it is possible that it is one of the test cases that is incompatible with C++17 rather than CPPUNIT itself? Also note that according to wikipedia, CPPUNIT "has been forked several times". If it is the framework that is incompatible, then the problem may be solvable by using a fork that is actively developed.
Upvotes: 1