2012-03-27 2 views
2

저는 Mac을 처음 사용합니다! 는 내가 xcode4.2를 다운로드) CppUTest-V3Cpputest 예제 빌드 실패

1을 만들려고 내가해야합니까 때, 나는 내가 LLVM 메이크업 명령을 사용하여 내가 만들 수 있다는 것을 발견

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 

다음과 같은 로그가

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) 그런 다음 예제 디렉토리로 이동합니다. 다음과 같은 오류가 발생했습니다. 조사하려고했지만 해결 방법을 찾을 수 없었습니다. 귀하의 도움을 주시면 감사하겠습니다.

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 

답변

6

Lpp을 실행하는 Mac에서 Cpp Testest가없는 libgcov.a의 위치를 ​​찾을 수있었습니다./usr/지방/lib 디렉토리에 64 비트 변형을 연결 한 후 내가 딸꾹질없이 CppUTest을 할 수 있었다 있도록

/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 

은 분명히 이러한 위치는 로더의 기본 검색 경로에 있지 않습니다. 행운

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 

최저