Frage

I'm using Xcode 4.6 and I've been writing some Unit Tests for an iOS app. I've tried to do some code coverage following from this tutorial: http://supermegaultragroovy.com/2005/11/03/unit-testing-and-code-coverage-with-xcode/ .

I've followed the 3 steps for my AppTests Target:

  • Check “Generate Test Coverage Files”
  • Check “Instrument Program Flow”
  • Add “-lgcov” to “Other Linker Flags”

The problem is that if I hit "Test" I get this error:

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

How can I fix this?

War es hilfreich?

Lösung

I think it's caused by your xcode version. Apple remove the library code-coverage needed after xcode 4.3. You need to add one file to your project manually. You can see check this blog for more details: http://www.gerardcondon.com/blog/2012/02/21/code-coverage-updates-for-xcode-4-dot-3/

You can try this. I tried but failed since my project include C++ code. I think that's because xcode 4.6 has not supported this feature...

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top