I created a simple class called bankAccount that I could test using cppunit. I then created a bankaccount_testcase class, whose .h file contains:
#include <include\cppunit\TestCase.h>
#include <include\cppunit\extensions\HelperMacros.h>
and whose signature is:
class bankaccount_testcase : public CppUnit::TestCase
The bankaccount_testcase.cpp file includes the line:
CPPUNIT_TEST_SUITE_REGISTRATION(bankaccount_testcase);
this file overrides the setUp() and tearDown() functions, and it also implements withdrawTest(), and depositTest(), my unit tests for bankAccount.
When I try to build this project, I get 35 linker errors, most of which read something like this:
When I built the CppUnitLibraries project, I got a lot of errors saying it couldn't open or didn't know how to build TestRunnerDSPlugInD.dll, but I read somewhere that that shouldn't matter that much. Also, I got a couple errors mentioning not being able to open mfc42ud.lib. I searched my hard drive for mfc42ud.lib, and got nothing.
Anybody have any idea about any of this?? Thanks in advance.
Nathan Dalton
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I had the same problem when I included a C header file in the cpp file containing the test class. Moving the #include below all other includes and CPPUNIT_TEST_SUITE_REGISTRATION() fixed the problem.
HTH,
Herbert
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Concerning the same error message, I have a question too. I'm getting linker errors LNK2019, LNK2001 (and LNK 1120 due to to LNK2001). I don't understand why it should give an 'unresolved error' message. All the #include statements pointing to include\cppUnit\HelperMacros.h are placed after the other includes.
I am using VS8, and the first thing I did was to recompile the solution CppUnitLibraries.dsw in VS8. Since the documentation said that the DSPlugIn would not be compatible VS7 onwards, I compiled all other projects except for that.
Then in the 'Properties\Configuration Properties\Linker\General\Additional Library Directories' field of my test project, I entered 'C:\cppunit-cvs-1.10.2\lib' as this folder contains the libraries generated by the CppUnitLibraries solution.
I thought this would be sufficient to link the library to my test project, but I'm still getting the same errors.
Could someone please suggest a fix?
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I created a simple class called bankAccount that I could test using cppunit. I then created a bankaccount_testcase class, whose .h file contains:
#include <include\cppunit\TestCase.h>
#include <include\cppunit\extensions\HelperMacros.h>
and whose signature is:
class bankaccount_testcase : public CppUnit::TestCase
The bankaccount_testcase.cpp file includes the line:
CPPUNIT_TEST_SUITE_REGISTRATION(bankaccount_testcase);
this file overrides the setUp() and tearDown() functions, and it also implements withdrawTest(), and depositTest(), my unit tests for bankAccount.
When I try to build this project, I get 35 linker errors, most of which read something like this:
bankaccount_testcase.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall CppUnit::Test::findTestPath(class CppUnit::Test const *,class CppUnit::TestPath &)const " (?findTestPath@Test@CppUnit@@UBE_NPBV12@AAVTestPath@2@@Z)
What's going on?
When I built the CppUnitLibraries project, I got a lot of errors saying it couldn't open or didn't know how to build TestRunnerDSPlugInD.dll, but I read somewhere that that shouldn't matter that much. Also, I got a couple errors mentioning not being able to open mfc42ud.lib. I searched my hard drive for mfc42ud.lib, and got nothing.
Anybody have any idea about any of this?? Thanks in advance.
Nathan Dalton
I had the same problem when I included a C header file in the cpp file containing the test class. Moving the #include below all other includes and CPPUNIT_TEST_SUITE_REGISTRATION() fixed the problem.
HTH,
Herbert
Hello
Concerning the same error message, I have a question too. I'm getting linker errors LNK2019, LNK2001 (and LNK 1120 due to to LNK2001). I don't understand why it should give an 'unresolved error' message. All the #include statements pointing to include\cppUnit\HelperMacros.h are placed after the other includes.
I am using VS8, and the first thing I did was to recompile the solution CppUnitLibraries.dsw in VS8. Since the documentation said that the DSPlugIn would not be compatible VS7 onwards, I compiled all other projects except for that.
Then in the 'Properties\Configuration Properties\Linker\General\Additional Library Directories' field of my test project, I entered 'C:\cppunit-cvs-1.10.2\lib' as this folder contains the libraries generated by the CppUnitLibraries solution.
I thought this would be sufficient to link the library to my test project, but I'm still getting the same errors.
Could someone please suggest a fix?
Thanks