I wrote and debugged a project on a workstation running uV3 (V3.30a) a while back. It contains a file that must be shared with other (von Neumann) processors that do not use Keil development tools and contains a pre-processor construct for the definition of an object:
#if defined(__C51__) struct unsMsgSpec const code sysParmTable[] = { #else struct unsMsgSpec const sysParmTable[] = { #endif
that eliminates the non-ANSI reserved word when running on non-Keil translators.
This same macro is used to declare the object in a header file:
#if defined(__C51__) extern struct unsMsgSpec const code sysParmTable[]; #else extern struct unsMsgSpec const sysParmTable[]; #endif
The source file that defines the object and the header that declares it are in the parent directory, beneath which are project directories for the several micros that must co- operate to run this embedded device.
The source module that references the 'sysParmTable[]' object pulls in the same header file:
#include "..\UnistarProtocol.h" /* CAN queries */
from its parent directory. As coded, it builds and links without error or warning on uV3.
I am attempting to hand it off to a co-worker who has uV4 (V4.60.6.10) on another workstation. During the link step of the build, this object generates an error:
*** ERROR L103: EXTERNAL ATTRIBUT DO NOT MATCH PUBLIC SYMBOL: SYSPARMTABLE MODULE: .\Debug\UnistarProtocol.obj (UNISTARPROTOCOL)
When I look at the pre-processor output for this object (in the module where it is defined), I see:
extern struct unsMsgSpec const sysParmTable[];
and
struct unsMsgSpec const sysParmTable[] = {
whereas, in the module where it is referenced, I see:
extern struct unsMsgSpec const code sysParmTable[];
It appears that the definition of __C51__ has become context-sensitive in uV4. Am I missing something?
============================================================ Gary Lynch printf("lynchg%cstacoenergy%ccom", 55+9, 55-9) ============================================================
Unrelated to the existence of __C51__ but one thing to consider when using the preprocessor to add/strop "code" is to write:
#if defined(__C51__) #define CODE code #else #define CODE #endif
Then you can have variables like:
struct unsMsgSpec const CODE sysParmTable[] = { ... };
So no need to duplicate the line. So only one place to change if you change the name of the data type or the name of the variable.
Cancel this request!
The problem was an older workaround to the same problem that I failed to remove when I created the __C51__ workaround. My apologies.