C语言编译报错:incompatible pointer type [-Wincompatible-pointer-types](传参类型不匹配)
生活随笔
收集整理的这篇文章主要介绍了
C语言编译报错:incompatible pointer type [-Wincompatible-pointer-types](传参类型不匹配)
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
代码:
//arnold add 20211213size_t save_video_box_buffer_size = 1920*1080*3/2;char* save_video_box_buffer = (char*)malloc(save_video_box_buffer_size); //开辟一块内存用来存储即将做编码推流的buffer(这先不用队列,看看写视频的速度怎么样先,不行再用队列) pthread_t main_stream_thread; ////pthread_create(&main_stream_thread, NULL, MainStream, NULL); //originpthread_create(&main_stream_thread, NULL, MainStream, save_video_box_buffer);警告:
ky_ai_camera_engine_origin.c:1519:45: warning: passing argument 3 of ‘pthread_create’ from incompatible pointer type [-Wincompatible-pointer-types]pthread_create(&main_stream_thread, NULL, MainStream, save_video_box_buffer);^~~~~~~~~~ In file included from /home/yg/rv/sdk/rv1.8/rv1126_rv1109/buildroot/output/rockchip_rv1126_rv1109/build/ky_ai_camera_engine_origin/src/ky_ai_camera_engine_origin.c:7: /home/yg/rv/sdk/rv1.8/rv1126_rv1109/buildroot/output/rockchip_rv1126_rv1109/host/arm-buildroot-linux-gnueabihf/sysroot/usr/include/pthread.h:236:15: note: expected ‘void * (*)(void *)’ but argument is of type ‘void * (*)(char *)’void *(*__start_routine) (void *),~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~原因是pthread_create()传参类型不一致!传的是void*,需要的是char*
可以统统都改成void*,包括malloc
总结
以上是生活随笔为你收集整理的C语言编译报错:incompatible pointer type [-Wincompatible-pointer-types](传参类型不匹配)的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: c语言内存拷贝 memcpy()函数
- 下一篇: C语言如何返回格式化日期时间(格式化时间