错误:

方法一
在test.c中定义
//test.c
......
struct pdesc const cameractrl_params[] = {
{PT_STRI_, 0, 1, OFFSET(cameractrl, homecmd), "homecmd", 32, 0, NULL, NULL},
{PT_STRI_, 0, 1, OFFSET(cameractrl, zoomctrl), "zoomctrl", 32, 0, NULL, NULL},
{PT_STRI_, 0, 1, OFFSET(cameractrl, focusctrl), "focusctrl", 32, 0, NULL, NULL},
{PT_STRI_, 0, 1, OFFSET(cameractrl, aperturectrl), "aperturectrl", 32, 0, NULL, NULL},
{PT_NULL_, 0, 0, 0, "", 0, 0, NULL, NULL} /* PT_NULL means tail of struct pdesc array */
};
......
在test.h中定义
//test.h
#ifndef _TEST_H_
#define _TEST_H_
......
extern struct pdesc const cameractrl_params[];
......
#endif
方法二
在test.h头文件中
变量前加static关键字
本文介绍了两种在C语言中定义相机控制参数的方法。一种是在源文件中直接定义,另一种是在头文件中使用static关键字进行定义。这有助于理解如何在项目中组织和访问全局变量。
1999

被折叠的 条评论
为什么被折叠?



