AnsweredAssumed Answered

C1815 Error When Variable is Already Declared

Question asked by adriano esposito on Feb 17, 2010
Latest reply on Feb 26, 2010 by adriano esposito

Hello,

 

I'm working on a project right now, and am having an annoying problem. The project is mostly done in C, with a few variable declarations in main.asm.

 

Codewarrior isn't recognizing the variables I'm declaring in main.asm. If I right-click the variable in main.c and select "Go to delcaration of X", it will go to the main.asm file where I declared it.

However, when I try to debug the project, the compiler says the variable hasn't been declared. Here are a few snippits of my code...

 

MAIN.ASM (the important variables here are the RAM_Lines)

 

; export symbols
            XDEF asm_main
            ; we use export 'Entry' as symbol. This allows us to
            ; reference 'Entry' either in the linker .prm file
            ; or from C/C++ later on

; Include derivative-specific definitions
        INCLUDE 'derivative.inc'          

            
; variable/data section
DEFAULT_RAM: SECTION
; Insert here your data definition.
;

temp_byte ds.b 1
RAM_line1 ds.b 16
RAM_line2 ds.b 16
RAM_line3 ds.b 16
RAM_line4 ds.b 16
SCI_RX_buf ds.b 16

; code section
MyCode:     SECTION

; this assembly routine is called by the C/C++ application
asm_main:
;          MOVB   #1,temp_byte   ; just some demonstration code
            NOP                   ; Insert here your own code

            RTC                   ; return to caller

 

MAIN.C

void main(void) {

EnableInterrupts;
asm_main();

 

strncpy(&RAM_line1[0],&line1[0],16);  //Before we start, we copy down the intro screen from
strncpy(&RAM_line2[0],&line2[0],16);  // flash into the RAM buffer used for the LCD
strncpy(&RAM_line3[0],&line3[0],16);
strncpy(&RAM_line4[0],&line4[0],16);                          

 

...

 

Once Codewarrior gets to strncpy(&RAM_line1[0],&line1[0],16);, it gives me an error (C1815), for all of the lines.

 

None of this is my code, it's code one of my teachers is having us put in our project. The project itself isn't about fixing this error, so I should be OK in posting this annoying error here.

 

Thanks in advance,

 

Adriano

Outcomes