- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试将单元测试框架 cMockery 添加到我的 C 项目中。我已经将 cMockery 下载并安装到全局包含路径中。但是在#include <cmockery.h>
之后在我的源文件中,cmake 引发了以下问题。如果我使用 cMocka
似乎会抛出同样的事情以及。我错过了一些包裹吗?
编辑:谷歌搜索 "/usr/include/google/cmockery.h:365:8: error: unknown type name ‘jmp_buf’"
正好返回 0 个结果(现在 1 个结果指向这个问题)。以及搜索 unknown type name 'jmp_buf'
只解释它是什么。不是如何修复它或为什么它会发生在 cmockery 中。
/usr/bin/cmake --build /home/.../data-structures-c/cmake-build-debug --target data_structures_c -- -j 3
Scanning dependencies of target data_structures_c
[ 50%] Building C object CMakeFiles/data_structures_c.dir/main.c.o
In file included from /home/.../data-structures-c/main.c:3:
/usr/include/google/cmockery.h:365:8: error: unknown type name ‘jmp_buf’
extern jmp_buf global_expect_assert_env;
^~~~~~~
make[3]: *** [CMakeFiles/data_structures_c.dir/build.make:63: CMakeFiles/data_structures_c.dir/main.c.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:73: CMakeFiles/data_structures_c.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/data_structures_c.dir/rule] Error 2
make: *** [Makefile:118: data_structures_c] Error 2
CMakeList.txt
也很标准,最低限度,只有一个 c 源代码
cmake_minimum_required(VERSION 3.12)
project(data_structures_c C)
set(CMAKE_C_STANDARD 99)
add_executable(data_structures_c main.c)
最佳答案
根据google/cmockery.h开头的评论标题:
/*
* These headers or their equivalents should be included prior to including
* this header file.
*
* #include <stdarg.h>
* #include <stddef.h>
* #include <setjmp.h>
*
* This allows test applications to use custom definitions of C standard
* library functions and types.
*/
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <google/cmockery.h>
关于cmake - CMockery 编译未知类型名称 "jmp_buf",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55614090/
我正在运行 Ubuntu 9.10 (Karmic Koala),我查看了 jmp_buf 结构,它只是一个包含 12 个整数的数组。当我使用 setjmp 并传入一个 jmp_buf 结构时——12
我正在尝试将单元测试框架 cMockery 添加到我的 C 项目中。我已经将 cMockery 下载并安装到全局包含路径中。但是在#include 之后在我的源文件中,cmake 引发了以下问题。如果
您好,我想问一下 setjmp/longjmp。我试图搜索,但我没有成功...... #include #include jmp_buf a, b; void jump() { int a
我试图将 jmp_buf 定义为指针并在嵌套的 longjmp(s) 中使用它。如下所示: ... jmp_buf *bfj; ... 然后写 if else: if( setjmp(*bfj) =
我需要帮助来利用 jmp_buf 结构上的缓冲区溢出。 我在堆栈上有以下值(由 gdb 看到): 0xbffffc40: 0xb7fd8ff4 0x080485a0 0x0
制作 jmp_buf 的拷贝并在以后恢复它是否可能并且有效?像 jmp_buf oldEnv = env; int val = setjmp(env); ....... env = oldEnv; 我
如前所述,当调用 setjmp(jmp_buf env) 时,x86-64 处理器上的 jmp_buf 中需要输入哪些软件可见的处理器状态?什么处理器状态没有? 我已经阅读了很多关于 setjmp 和
setjmp() 应该将包括“返回地址”和“堆栈指针”在内的寄存器保存到“jmp_buf”中。当我使用 glibc 在 x86_64 下编译(gcc 和 clang)和调试以下程序时,我无法理解“jm
我需要确保我首先了解一些基本知识: 如何将函数 A 作为参数传递给函数 B? 如何从 B 内部调用函数 A? 现在是重头戏: 我正在尝试按照以下方式做一些事情: jmp_buf buf; buf.__
我是一名优秀的程序员,十分优秀!