相关疑难解决方法(0)

gcov符号在哪里?

我正在尝试使用gcov编译一个简单的应用程序并获得以下链接错误:

gcc AllTests.o CuTestTest.o CuTest.o -o TestTest
AllTests.o: In function `global constructors keyed to 0_RunAllTests':
/home/p7539c/cutest/AllTests.c:26: undefined reference to `__gcov_init'
AllTests.o:(.data+0x44): undefined reference to `__gcov_merge_add'
CuTestTest.o: In function `global constructors keyed to 0_TestCuStringNew':
/home/p7539c/cutest/CuTestTest.c:30: undefined reference to `__gcov_init'
CuTestTest.o:(.data+0x64): undefined reference to `__gcov_merge_add'
CuTest.o: In function `global constructors keyed to 0_CuStrAlloc':
/home/p7539c/cutest/CuTest.c:379: undefined reference to `__gcov_init'
CuTest.o:(.data+0x184): undefined reference to `__gcov_merge_add'
collect2: ld returned 1 exit status
make: *** [TestTest] Error 1
Run Code Online (Sandbox Code Playgroud)

我似乎找不到丢失符号的位置.gcov存在于运行gcc 4.1.2版的机器上

有任何想法吗?谢谢.

在编辑:

将gcov与包含一个.c文件的应用程序一起使用时,一切似乎都能正常工作.当我有多个.c文件(因此有多个.o文件)时,我遇到了上述问题.

编译步骤如下所示:

cc -fprofile-arcs …
Run Code Online (Sandbox Code Playgroud)

profile gcc gcov

58
推荐指数
5
解决办法
5万
查看次数

标签 统计

gcc ×1

gcov ×1

profile ×1