关于Linux C multiple definition of‘XXX’的问题
方法一:
在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關鍵字
新人創作打卡挑戰賽發博客就能抽獎!定制產品紅包拿不停!總結
以上是生活随笔為你收集整理的关于Linux C multiple definition of‘XXX’的问题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Redis 主从复制的几种方法
- 下一篇: 定点数运算