Code coverage with GCOV can't produce .gcda fi

2019-05-23 16:38发布

问题:

I want to get code coverage with GCOV, I set build setting by http://developer.apple.com/library/mac/#qa/qa2007/qa1514.html

  • add "-lgcov" to "Other Linker Flags"
  • check "Instrument Program Flow"
  • check "Generate Test Coverage Files"

but I can't produce the .gcda file, could anyone help?

回答1:

The simulator has to close before the gcda files get generated. So, when I run GHUnit I have to close this app first. There's also a setting in the plist to kill the app when it closes, rather than have it sit there ready to restart.



回答2:

I have posted the settings and configurations that worked for me at Code coverage not showing results using Xcode + gcov



回答3:

I had the same problem with Xcode 4.3.2. Setting "Generate Profiling Code" to YES caused that after testing gcda files are generated.