- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我尝试使用 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
我似乎找不到丢失符号的位置。 gcov 存在于运行 gcc 版本 4.1.2 的计算机上
有什么想法吗?谢谢。
编辑时:
将 gcov 与包含一个 .c 文件的应用程序一起使用时,一切似乎都工作正常。当我有多个 .c 文件(因此有多个 .o 文件)时,我遇到上述问题。
编译步骤如下所示:
cc -fprofile-arcs -ftest-coverage -g -c -o AllTests.o AllTests.c
cc -fprofile-arcs -ftest-coverage -g -c -o CuTestTest.o CuTestTest.c
cc -fprofile-arcs -ftest-coverage -g -c -o CuTest.o CuTest.c
最佳答案
我刚刚花了令人难以置信的时间来调试一个非常相似的错误。这是我学到的:
-fprofile-arcs -ftest-coverage
。-fprofile-arcs
。链接时您仍然会遇到奇怪的链接器错误。它们看起来像这样:
libname.a(objfile.o):(.ctors+0x0):对“以 long_name_of_file_and_function 为键的全局构造函数”的 undefined reference
这意味着 gconv 的编译器生成的构造函数之一(在我的例子中是复制构造函数)存在问题。检查错误消息中提到的函数,查看它复制构造的对象类型,并查看这些类中是否有任何一个没有复制构造函数。添加一个,错误就会消失。
编辑:是否优化也会影响这一点。如果您遇到问题,请尝试打开/关闭优化。
关于gcc - gcov 符号在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/566472/
我使用 gcc -fprofile-arcs -ftest-coverage [filenames] 在一些 .c 文件上运行 gcov 工具。命令 但向该命令提供文件名是一项非常繁琐的工作。 相反,
我可以在 Windows 中安装 gcov 工具吗? 或者我可以在windows的eclipse中使用这个工具的插件吗? 我对这个工具很陌生。我对这个工具没有任何想法。请帮我获取这个工具的信息。 请告
我在 RHEL 上运行 gcov/gcc 4.1.2。 当我想为 gcov 文件指定一个目录时。关于如何执行此操作的任何想法? 最佳答案 从要创建其文件的目录运行 gcov。您必须使用 -o 参数来告
我正在尝试使用 gcov-tool 为多个源文件合并一些现有的覆盖率数据(不是我自己创建的)。但是当我调用 gcov-tool merge dir1 dir2 时,dir1 和 dir2 是包含 .g
我正在运行 gcov 来测量覆盖率,但对于我在 C 代码中使用的每个函数,我都收到“有来自退出 block 的弧”消息。这条消息有什么问题吗?我应该忽略它们吗? 最佳答案 这可能意味着您的 gcno
我正在尝试使用 gcc 4.8.2 和 lcov 1.10 获取 html 覆盖率以进行测试。我确定我的源文件、对象和 gcov 文件位于同一位置,并且我正在从我运行编译器的目录中运行 lcov。 我
我在远程服务器上用 gcov 标志编译了我的源文件。 CFLAGS += -fprofile-arcs -ftest-coverage -lgcov -coverage 编译工作正常。 gcc 4.7
在使用 gcov 支持编译我的项目时,我面临以下错误 以下是我在编译时的标志信息 编译器标志: CXXFLAGS="-Wno-deprecated -g -ggdb -fprofile-arcs -f
我正在尝试在 iPhone 项目上使用 gcov 并遵循 Apple 的说明 here ,但它不起作用。 当我构建并配置项目时,会为每个目标文件创建 .gcda 文件。但没有执行的行记录到 .gcda
我尝试使用 gcov 编译一个简单的应用程序并收到以下链接错误: gcc AllTests.o CuTestTest.o CuTest.o -o TestTest AllTests.o: In fun
资料夹结构 〜/沙盒/ dev 〜/沙盒/测试 我在dev目录中有main.cpp。我使用--coverage标志编译了代码以生成代码覆盖率。 现在,将生成a.out和main.gcno文件。 现在我
我正在使用 gcov 来获取我们项目的代码覆盖率,但它经常报告 50% 的普通函数调用的条件覆盖率。函数是否接受任何参数或返回任何数据都没有任何区别。我在 Jenkins 中使用 gcovr 和 Co
无法使用我的 C/C++ Makefile 项目在 Windows 上使用 mingw32 的 googletest 获取 gcov 覆盖文件完整源代码位于https://github.com/rus
我正在使用 gcov这是我第一次遇到与此 thread 中报告的问题类似的问题.但是,根据该线程中的评论,我无法解决我的问题。 我正在尝试测量 KMyMoney-4.6.4 中具体测试用例的覆盖率,即
我正在使用 eclipse indigo 和 linux 工具。其中一个工具是 gcov 的插件。我有一个项目是 statis lib(点一个文件)和另一个项目是一个单元测试,它与这个 lib 链接并
我在 32 位机器上使用 -fprofile-arcs -ftest-coverage 标志交叉编译我的可执行文件以覆盖。我在 64 位目标机器上运行生成的可执行文件。 当我运行可执行文件时,它不会生
是否可以使用 gcov 进行多线程应用程序的覆盖测试? 我已经对我们的代码库进行了一些简单的测试,但如果能对我们正在实现的覆盖范围有一些了解就更好了。如果 gcov 不合适,任何人都可以推荐一个替代工
我正在使用 gcov 来衡量我贡献的 c++ 库的测试覆盖率。出于某种原因,gcov 无法将许多文件中的行识别为可执行文件。在给定文件的 160 多行中,它会说其中 40 行是可执行的。例如:
MWE #include struct Foo { Foo() { std::cout << "Constructing Foo " << this << std::endl; }
我正在使用 gcov 测量我的 C++ 代码中的覆盖率。我希望能够标记某些源代码行,以便在使用 gcovr 时将它们排除在覆盖率报告之外。我知道它们存在,因为我曾经偶然发现过它们,但现在我找不到看到它
我是一名优秀的程序员,十分优秀!