XGate Shared Variables Link Errors (S12XE)

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

XGate Shared Variables Link Errors (S12XE)

跳至解决方案
875 次查看
rayhall
Contributor V

I am getting link errors and warnings when I make my project. I do not know how to fix them. This shows the errors.  http://www.turbofast.com.au/tfbin/ErrorsCanLogger.png

 

The problem relates to a structure that is defined in the GlobalsShared.h file. I get no errors when I compile the project.

 

I have attached the project files.

 

Ray.

Original Attachment has been moved to: CAN_Logger.zip

标签 (1)
0 项奖励
1 解答
662 次查看
kef2
Senior Contributor IV

XGATE compiler by default word aligns all struct members with sizeof() > 1. So you need to either insert "uint8_t dummy;" below or above unpaired acRequest , or in HC12 sources, which include GlobalsShared.h use pragma align like this

#pragma align on

#include "GlobalsShared.h"

#pragma align off

This will resolve different object size message. And to resolve "object defined twice", you need to insert extern keyword above your struct in *.h file.

Edward

在原帖中查看解决方案

0 项奖励
2 回复数
663 次查看
kef2
Senior Contributor IV

XGATE compiler by default word aligns all struct members with sizeof() > 1. So you need to either insert "uint8_t dummy;" below or above unpaired acRequest , or in HC12 sources, which include GlobalsShared.h use pragma align like this

#pragma align on

#include "GlobalsShared.h"

#pragma align off

This will resolve different object size message. And to resolve "object defined twice", you need to insert extern keyword above your struct in *.h file.

Edward

0 项奖励
662 次查看
rayhall
Contributor V

Edward,

Thank you,

Ray.

0 项奖励