No code coverage with Mac OS X Lion and XCode 4 / llvm-g++-4.2

别等时光非礼了梦想. 提交于 2019-11-29 14:32:27
Ben Hocking

I was able to figure out an answer to this question using help from this answer. Basically, I changed my coverage commands to use clang instead of g++ (because the example file was pure C, I went with clang instead of clang++, which I've verified works just fine with C++ files). From there, I was able to use lcov to generate output similar to what I'm used to seeing from Java/cobertura.

On Lion g++ is an alias for llvm-g++, as you have discovered. To invoke "real" gcc, use gcc-4.2 or g++-4.2:

g++-4.2 -g -O0 --coverage -o $PWD/bin/cov $PWD/obj/*.o
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!