error: incompatible type for argument 1 of ‘json_string’ json_object_set_new(root, "time", json_string(tval));
时间: 2024-03-10 07:45:04 浏览: 21
这个错误提示是因为你传入的参数类型不匹配导致的。json_string() 函数需要的是一个 char* 类型的字符串作为参数,而你传入的是一个 tval 类型的变量。你需要将 tval 转换成 char* 类型后再传入 json_string() 函数中。可以使用 sprintf() 函数将 tval 转换成 char* 类型,例如:
```
char tval_str[20];
sprintf(tval_str, "%d", tval);
json_object_set_new(root, "time", json_string(tval_str));
```
这样就能将 tval 转换成字符串类型,再将其作为参数传入 json_string() 函数中了。
相关问题
GstVideoCodecState *state = gst_video_codec_state_new(); gst_video_decoder_set_output_state(GST_VIDEO_DECODER(h264parse_), state);出现了error: incompatible type for argument 2 of ‘gst_video_decoder_set_output_state’GstVideoCodecState * {aka struct _GstVideoCodecState *}
这个错误提示意味着函数`gst_video_decoder_set_output_state`的第二个参数类型与函数定义不匹配。通常,这个错误是由于传递给函数的参数类型与函数声明中参数类型不一致导致的。你需要检查函数声明并确保第二个参数的类型与函数声明中的类型匹配。
在这个特定的问题中,你需要确保在调用`gst_video_decoder_set_output_state`函数时,第一个参数是`GstVideoDecoder`类型的对象,第二个参数的类型是`GstVideoCodecState *`类型的指针。如果类型匹配但是仍然存在问题,你需要检查是否正确包含相关头文件和库文件。
另外,请确保你已经包含了`gst/video/video.h`头文件,因为`gst_video_decoder_set_output_state()`函数的声明位于该头文件中。
error: incompatible types when initializing type ‘__m256i {aka const __vector(4) long long int}’ using type ‘int
这个错误是因为你在初始化 `__m256i` 类型的变量时使用了 `int` 类型的值,这两种类型是不兼容的。你需要确保你的变量类型与初始化值类型相同。
可能的解决方法取决于你的具体代码和使用情况。如果你需要将 `int` 类型的值存储到 `__m256i` 类型的变量中,你可以使用 `_mm256_set_epi32()` 或 `_mm256_set_epi64x()` 函数来创建一个新的 `__m256i` 类型的值。
例如,如果你想将 `int` 类型的值 `a`, `b`, `c`, `d`, `e`, `f`, `g`, 和 `h` 存储到一个 `__m256i` 类型的变量 `vec` 中,你可以这样做:
```
__m256i vec = _mm256_set_epi32(h, g, f, e, d, c, b, a);
```
或者,如果你想将 `long long int` 类型的值 `a`, `b`, `c`, 和 `d` 存储到一个 `__m256i` 类型的变量 `vec` 中,你可以这样做:
```
__m256i vec = _mm256_set_epi64x(d, c, b, a);
```