Unfortunately at the linking stage I get the error
undefined reference to `TestCalculator::TestCalculator()
Seems to be related to linking, but I have no clue why.
Any help is appreciated! Many thanks!!!
IDE is Eclipse
11:58:57 * Incremental Build of configuration Debug for project CppUnit_Test_no1 *
Info: Internal Builder is used for build
g++ "-LC:\Users\jumo\.eclipse\cppunit-1.12.1\src\cppunit\.libs" -o CppUnit_Test_no1.exe "src\Test_MainRunner.o" "src\TestCalculator.o" "src\Calculator.o" -lcppunit
src\Test_MainRunner.o: In function main':
C:\Users\jumo\workspace\CppUnit_Test_no1\Debug/../src/Test_MainRunner.cpp:36: undefined reference toTestCalculator::TestCalculator()'
Test_MainRunner.cpp:
int main() {
cout << "CppUnit My Test no1" << endl;
CppUnit::TextUi::TestRunner runner;
runner.addTest( new TestCalculator() ); <== here the error comes
...
Hi,
I'm a newcomer to CppUnit and for that, I followed a basic introduction at http://linuxtortures.blogspot.de/2012/04/unit-testing-with-cppunit-and-eclipse.html
Unfortunately at the linking stage I get the error
undefined reference to `TestCalculator::TestCalculator()
Seems to be related to linking, but I have no clue why.
Any help is appreciated! Many thanks!!!
IDE is Eclipse
11:58:57 * Incremental Build of configuration Debug for project CppUnit_Test_no1 *
Info: Internal Builder is used for build
g++ "-LC:\Users\jumo\.eclipse\cppunit-1.12.1\src\cppunit\.libs" -o CppUnit_Test_no1.exe "src\Test_MainRunner.o" "src\TestCalculator.o" "src\Calculator.o" -lcppunit
src\Test_MainRunner.o: In function
main': C:\Users\jumo\workspace\CppUnit_Test_no1\Debug/../src/Test_MainRunner.cpp:36: undefined reference to
TestCalculator::TestCalculator()'Test_MainRunner.cpp:
TestCalculator.h:
TestCalculator.cpp
Problem solved: missing declaration (not related anyhow to CppUnit)
wrong:
class Calculator {
public:
Calculator();
...
correct:
class Calculator {
public:
Calculator(){};
...