Board index » cppbuilder » Getting Undefined symbol error

Getting Undefined symbol error


2005-02-20 03:52:10 PM
cppbuilder48
Hello, I received some code from the net. When I compile it I receive a
"Undefined symbol P2DIR" for line:
high(SDA);
In the code it looks like P2DIR is defined so I don't know whats going on.
Can someone tell me what's going on and maybe how to work around it so I can
compile and run the code? Thanks.
// Macros to access SDA/SCL lines readably
#define high(a) P2DIR &= ~(a)
#define low(a) P2DIR |= (a)
#define read(a) (P2IN & (a))
char readByte(void){
int i;
char byte;
int inputbit;
high(SDA);
byte = 0;
for (i = 0; i < 8; i++) {
high(SCL);
inputbit = read(SDA);
byte = byte << 1;
if(inputbit){
byte = byte + 1;
}
low(SCL);
}
return byte;
}
 
 

Re:Getting Undefined symbol error

"Maurice Anderson" < XXXX@XXXXX.COM >wrote:
Quote

[...] In the code it looks like P2DIR is defined so I don't
know whats going on.
It may look like it's defined but it is not. You need to go
back to where you got it from and look for how it's defined
because the code you posted does *not* show it's definition
which should preceed the macros.
My guess is that it's a simple WORD.
~ JD
 

Re:Getting Undefined symbol error

Quote
My guess is that it's a simple WORD.
Thanks for responding. So if I wanted to define it as a WORD, how would
that look like?
 

{smallsort}

Re:Getting Undefined symbol error

"Maurice Anderson" < XXXX@XXXXX.COM >wrote:
Quote
>My guess is that it's a simple WORD.

Thanks for responding. So if I wanted to define it as a WORD, how would
that look like?
WORD SP2WhatEver;
~ JD
 

Re:Getting Undefined symbol error

On Sat, 19 Feb 2005 23:52:10 -0800, Maurice Anderson wrote:
Quote
In the code it looks like P2DIR is defined so I don't know whats going on.
In the code snippet you present there is no definition of P2DIR.
Hence the error message.
--
Good luck,
liz