c++ - What does "void-value is not ignored" error mean and how to remove it? -
i try compile following code:
#include <cppunit/extensions/helpermacros.h> #include "tested.h" class testtested : public cppunit::testfixture { cppunit_test_suite(testtested); cppunit_test(check_value); cppunit_test_suite_end(); public: void check_value(); }; cppunit_test_suite_registration(testtested); void testtested::check_value() { tested t(3); int expected_val = t.getvalue(); // <----- line 18. cppunit_assert_equal(7, expected_val); }
as result get:
testing.cpp:18:32: error: void-value not ignored should
eddit
to make example complete post code of tested.h
, tested.cpp
:
tested.h
#include <iostream> using namespace std; class tested { private: int x; public: tested(int int_x); void getvalue(); };
tested.cpp
#include <iostream> using namespace std; tested::tested(int x_inp) { x = x_inp; } int tested::getvalue() { return x; }
you declare void getvalue();
in class tested.. change int getvalue();
.
Comments
Post a Comment