2012-03-27 5 views
2

Ich bin neu bei Mac! ich laden Sie die xcode4.2 und versuchte CppUTest-v3CppUTest Beispiele Build schlägt fehl

1), wenn ich machen, ich habe die folgenden Protokolle

compiling AllTests.cpp 
compiling AllocationInCppFile.cpp 
compiling CheatSheetTest.cpp 
compiling CommandLineArgumentsTest.cpp 
compiling CommandLineTestRunnerTest.cpp 
compiling JUnitOutputTest.cpp 
compiling MemoryLeakDetectorTest.cpp 
compiling MemoryLeakOperatorOverloadsTest.cpp 
compiling MemoryLeakWarningTest.cpp 
compiling NullTestTest.cpp 
compiling PluginTest.cpp 
compiling PreprocessorTest.cpp 
compiling SetPluginTest.cpp 
compiling SimpleStringTest.cpp 
compiling TestFailureTest.cpp 
compiling TestFilterTest.cpp 
compiling TestHarness_cTest.cpp 
compiling TestInstallerTest.cpp 
compiling TestMemoryAllocatorTest.cpp 
compiling TestOutputTest.cpp 
compiling TestRegistryTest.cpp 
compiling TestResultTest.cpp 
compiling UtestTest.cpp 
compiling AllocationInCFile.c 
compiling TestHarness_cTestCFile.c 
compiling CommandLineArguments.cpp 
compiling CommandLineTestRunner.cpp 
compiling JUnitTestOutput.cpp 
compiling MemoryLeakDetector.cpp 
compiling MemoryLeakWarningPlugin.cpp 
compiling SimpleString.cpp 
compiling TestFailure.cpp 
compiling TestFilter.cpp 
compiling TestHarness_c.cpp 
compiling TestMemoryAllocator.cpp 
compiling TestOutput.cpp 
compiling TestPlugin.cpp 
compiling TestRegistry.cpp 
compiling TestResult.cpp 
compiling Utest.cpp 
compiling UtestPlatform.cpp 
Building archive lib/libCppUTest.a 
ar: creating archive lib/libCppUTest.a 
a - objs/src/CppUTest/CommandLineArguments.o 
a - objs/src/CppUTest/CommandLineTestRunner.o 
a - objs/src/CppUTest/JUnitTestOutput.o 
a - objs/src/CppUTest/MemoryLeakDetector.o 
a - objs/src/CppUTest/MemoryLeakWarningPlugin.o 
a - objs/src/CppUTest/SimpleString.o 
a - objs/src/CppUTest/TestFailure.o 
a - objs/src/CppUTest/TestFilter.o 
a - objs/src/CppUTest/TestHarness_c.o 
a - objs/src/CppUTest/TestMemoryAllocator.o 
a - objs/src/CppUTest/TestOutput.o 
a - objs/src/CppUTest/TestPlugin.o 
a - objs/src/CppUTest/TestRegistry.o 
a - objs/src/CppUTest/TestResult.o 
a - objs/src/CppUTest/Utest.o 
a - objs/src/Platforms/Gcc/UtestPlatform.o 
Linking CppUTest_tests 

ld: library not found for -lgcov 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 
make: *** [CppUTest_tests] Error 1 

Ich fand heraus, zu bauen, dass ich mithilfe der llvm Befehl make bauen

CC=/Applications/Xcode.app/Contents/Developer/usr/bin/llvm-gcc-4.2 make 
Linking CppUTest_tests 
Running CppUTest_tests 
.................................................. 
.................................................. 
.................................................. 
.................................................. 
.................................................. 
........................................... 
OK (293 tests, 293 ran, 791 checks, 0 ignored, 0 filtered out, 7 ms) 

2) Dann cd in das Beispielverzeichnis. Ich habe folgende Fehler bekommen. Ich habe versucht nachzuforschen, konnte aber nicht herausfinden, wie ich es lösen kann. Ihre Hilfe wird geschätzt.

compiling AllTests.cpp 
compiling CircularBuffer.cpp 
compiling CircularBufferTest.cpp 
compiling EventDispatcher.cpp 
compiling EventDispatcherTest.cpp 
compiling HelloTest.cpp 
compiling MockDocumentationTest.cpp 
ApplicationLib/MockDocumentationTest.cpp:193:85: warning: expression result unused [-Wunused-value] 
     mock_c()->actualCall("foo")->withIntParameters("integer", 10)->returnValue().value.doubleValue; 
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~ 
1 warning generated. 
compiling Printer.cpp 
compiling PrinterTest.cpp 
compiling hello.c 
Building archive lib/libCppUTestExamples.a 
ar: creating archive lib/libCppUTestExamples.a 
a - objs/ApplicationLib/CircularBuffer.o 
a - objs/ApplicationLib/CircularBufferTest.o 
a - objs/ApplicationLib/EventDispatcher.o 
a - objs/ApplicationLib/EventDispatcherTest.o 
a - objs/ApplicationLib/HelloTest.o 
a - objs/ApplicationLib/MockDocumentationTest.o 
a - objs/ApplicationLib/Printer.o 
a - objs/ApplicationLib/PrinterTest.o 
a - objs/ApplicationLib/hello.o 
Linking CppUTestExamples_tests 
Undefined symbols for architecture x86_64: 
    "_main", referenced from: 
     start in crt1.10.6.o 
    "mock(SimpleString const&)", referenced from: 
     TEST_EventDispatcher_EventWithRegistrationForEventResultsIntoCallback_Test::testBody()  in libCppUTestExamples.a(EventDispatcherTest.o) 
     TEST_EventDispatcher_RegisterTwoObserversResultIntoTwoCallsAndARegistrationNotification_Test::testBody()  in libCppUTestExamples.a(EventDispatcherTest.o) 
     TEST_GROUP_CppUTestGroupEventDispatcher::setup()  in libCppUTestExamples.a(EventDispatcherTest.o) 
     TEST_GROUP_CppUTestGroupEventDispatcher::teardown()  in libCppUTestExamples.a(EventDispatcherTest.o) 
     ObserverMock::notify(Event const&, int)in libCppUTestExamples.a(EventDispatcherTest.o) 
     ObserverMock::notifyRegistration(EventObserver*)  in libCppUTestExamples.a(EventDispatcherTest.o) 
     productionCode()  in libCppUTestExamples.a(MockDocumentationTest.o) 
     ... 
    "MockNamedValue::getIntValue() const", referenced from: 
     TEST_MockDocumentation_returnValue_Test::testBody()  in libCppUTestExamples.a(MockDocumentationTest.o) 
     TEST_MockDocumentation_setData_Test::testBody()  in libCppUTestExamples.a(MockDocumentationTest.o) 
    "MockNamedValue::~MockNamedValue()", referenced from: 
     TEST_MockDocumentation_returnValue_Test::testBody()  in libCppUTestExamples.a(MockDocumentationTest.o) 
     TEST_MockDocumentation_setData_Test::testBody()  in libCppUTestExamples.a(MockDocumentationTest.o) 
    "MockSupport::setData(SimpleString const&, int)", referenced from: 
     TEST_MockDocumentation_setData_Test::testBody()  in libCppUTestExamples.a(MockDocumentationTest.o) 
    "MockSupport::setDataObject(SimpleString const&, SimpleString const&, void*)", referenced from: 
     TEST_MockDocumentation_setData_Test::testBody()  in libCppUTestExamples.a(MockDocumentationTest.o) 
    "MockSupport::getData(SimpleString const&)", referenced from: 
     TEST_MockDocumentation_setData_Test::testBody()  in libCppUTestExamples.a(MockDocumentationTest.o) 
    "MockNamedValue::getObjectPointer() const", referenced from: 
     TEST_MockDocumentation_setData_Test::testBody()  in libCppUTestExamples.a(MockDocumentationTest.o) 
    "_mock_c", referenced from: 
     TEST_MockDocumentation_CInterface_Test::testBody()  in libCppUTestExamples.a(MockDocumentationTest.o) 
    "_mock_scope_c", referenced from: 
     TEST_MockDocumentation_CInterface_Test::testBody()  in libCppUTestExamples.a(MockDocumentationTest.o) 
ld: symbol(s) not found for architecture x86_64 

collect2: ld returned 1 exit status 
make: *** [CppUTestExamples_tests] Error 1 

Antwort

6

Ich konnte den Speicherort von CppUTests fehlenden libgcov.a auf meinem Mac mit Lion finden.

/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/libgcov.a 
/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/x86_64/libgcov.a 

Offenbar diese Orte sind nicht in dem Ladestandardsuchpfad, so dass nach Verknüpfung der 64-Bit-Variante nach/usr/local/lib ich in der Lage war CppUTest ohne Stottern zu machen.

sudo ln -s /usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/x86_64/libgcov.a /usr/local/lib/libgcov.a 

Best of luck