0
--------------------Configuration: AllTests - Win32 Debug--------------------
Linking...
AllTests.obj : error LNK2001: unresolved external symbol "int externTestGroupMockDocumentation" (?externTestGroupMockDocumentation@@3HA)
AllTests.obj : error LNK2001: unresolved external symbol "int externTestGroupEventDispatcher" (?externTestGroupEventDispatcher@@3HA)
Debug/AllTests.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

AllTests.exe - 3 error(s), 0 warning(s)

Why do I get these errors and how can I resolve them?

sth
  • 222,467
  • 53
  • 283
  • 367
  • 1
    The title seems to match the content, but the post doesn't seem to match StackOverflow. Please ask a question and provide some more details, so we'll be able to answer. – MByD Jul 23 '11 at 01:47

2 Answers2

0

wondering if you got over this issue,
I am facing the same issue although I have

IMPORT_TEST_GROUP(my_test_group);  

in AllTests.cpp and properly defining

TEST_GROUP(my_test_group) {};  

in my_test.cpp as per Mr. Grenning's advice.

Notice I have been able to get it to compile by applying either one of the following workarounds:

1- Add the cpp file containing the function definition to the UnitTest project. Or..
2- Have the function definition in the header file (typical if your function is a template)

I don't know if either/any of the suggestions is correct (so not claiming an answer yet), however, I mention my workaround here in the hope others might find it helpful.

N.B. I have CppUTest-3.6 configured with visual studio 2010 according to "D:\cpputest-3.6\docsWalkThrough_VS21010.docx"

Hasan

has981
  • 425
  • 4
  • 18
0

Do you have these lines in your AllTests.cpp?

IMPORT_TEST_GROUP(MockDocumentation)
IMPORT_TEST_GROUP(EventDispatcher)

If you do, you also need to have these test groups defined in you build:

TEST_GROUP(MockDocumentation)
TEST_GROUP(EventDispatcher)

James