OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 4723|回复: 5

求助,关于F1的位操作

[复制链接]

5

主题

42

帖子

0

精华

初级会员

Rank: 2

积分
127
金钱
127
注册时间
2012-8-2
在线时间
8 小时
发表于 2014-11-1 14:26:24 | 显示全部楼层 |阅读模式
5金钱
我在.h中声明了联合,用extern声明了变量,但还是出现了 Error: L6218E: Undefined symbol main_flag3 (referred from usart.o). 

typedef union _MainTabunion_TypeDef      
{   
     u8 ctrlval;   
     struct  
    {   
    u8 Bit0:1;   
    u8 Bit1:1;   
    u8 Bit2:1;  
    u8 Bit3:1;  
    u8 Bit4:1;  
    u8 Bit5:1;   
    u8 Bit6:1;  
    u8 Bit7:1;  
  }MainTab;   
}MainTabunion_TypeDef;  

extern MainTabunion_TypeDef  main_flag3 
#define welding main_flag3.MainTab.Bit0 
#define checksilk_pannel                           main_flag3.MainTab.Bit1 
#define save_blank main_flag3.MainTab.Bit2 
#define Uart_busy main_flag3.MainTab.Bit3 
#define InError main_flag3.MainTab.Bit4 
#define InshowError main_flag3.MainTab.Bit5 
#define showmodechanged main_flag3.MainTab.Bit6 
#define savechn_blank             main_flag3.MainTab.Bit7

.c中Uart_busy=1或者0

最佳答案

查看完整内容[请看2#楼]

extern MainTabunion_TypeDef  main_flag3  有;没?
conscience,confidence,courage
正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

72

主题

2711

帖子

2

精华

论坛大神

Rank: 7Rank: 7Rank: 7

积分
3505
金钱
3505
注册时间
2014-8-4
在线时间
696 小时
发表于 2014-11-1 14:26:25 | 显示全部楼层
extern MainTabunion_TypeDef  main_flag3 
有;没?
以我资质之鲁钝,当尽平心静气、循序渐进、稳扎稳打之力。
回复

使用道具 举报

5

主题

42

帖子

0

精华

初级会员

Rank: 2

积分
127
金钱
127
注册时间
2012-8-2
在线时间
8 小时
 楼主| 发表于 2014-11-1 14:26:25 | 显示全部楼层
回复【5楼】龙之谷:
---------------------------------
解决了,在.c中还要声明MainTabunion_TypeDef  main_flag3 ,- -!C小白谢谢你的指点,
conscience,confidence,courage
回复

使用道具 举报

72

主题

2711

帖子

2

精华

论坛大神

Rank: 7Rank: 7Rank: 7

积分
3505
金钱
3505
注册时间
2014-8-4
在线时间
696 小时
发表于 2014-11-1 14:46:32 | 显示全部楼层
联合定义前也加个extern试试
以我资质之鲁钝,当尽平心静气、循序渐进、稳扎稳打之力。
回复

使用道具 举报

5

主题

42

帖子

0

精华

初级会员

Rank: 2

积分
127
金钱
127
注册时间
2012-8-2
在线时间
8 小时
 楼主| 发表于 2014-11-1 15:02:58 | 显示全部楼层
.


\Include\sys.h(58): error:  #81: more than one storage class may not be specified
conscience,confidence,courage
回复

使用道具 举报

5

主题

42

帖子

0

精华

初级会员

Rank: 2

积分
127
金钱
127
注册时间
2012-8-2
在线时间
8 小时
 楼主| 发表于 2014-11-1 15:04:51 | 显示全部楼层
回复【2楼】龙之谷:
--------------------------------
.\Include\sys.h(58): error:  #81: more than one storage class may not be specified
报错了,这是类定义,可能不需要extern吧
conscience,confidence,courage
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-6-29 16:42

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表