微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

linux c 报错 multiple definition of ‘xxx’ 解决方法

错误

方法

在test.c中定义

//test.c
......

struct pdesc const cameractrl_params[] = {
{PT_STRI_, 1,OFFSET(cameractrl,homecmd),"homecmd",32,NULL,NULL},    {PT_STRI_,zoomctrl),"zoomctrl",focusctrl),"focusctrl",aperturectrl),"aperturectrl",    {PT_NULL_, 0,"",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关键字

 

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐