This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

linker errors for C file related to header

Hi Folks
I must be doing something stupid.
Simple program, main.c has code

#include<reg51.h>
#include"sevenSeg.h"

void main (void) {
        while (1)
                sevenSegWriteDecDigit(8);
        return;
}

sevenSeg.h, which was added to the projecy automatically after the first compile of main.c has code

extern void sevenSegWriteDecDigit(unsigned char decDigit);

sevenSeg.c has not been added to project but has code

#ifndef __REG51_H__
        sfr P1 = 0x90;
#endif

// This function displays the given decDigit on the display.
// If the number in decDigit is greater than 9 no segments are lit.
void sevenSegWriteDecDigit(unsigned char decDigit) {
        if (decDigit > 9) { // If not a number between 0 and 9, inclusive ...
                P1 = 0x0F;              // turn all segments off
        } else {
                P1 = decDigit;
        }
        return;
}

And when I try to compile I get two linker warnings that suggest that the sevenSeg.c isnt being found...

*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL
    SYMBOL:  _SEVENSEGWRITEDECDIGIT
    MODULE:  main.obj (MAIN)
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL
    SYMBOL:  _SEVENSEGWRITEDECDIGIT
    MODULE:  main.obj (MAIN)
    ADDRESS: 080FH

Im racking my brains as to how this can be?!?!

Just noticed in the project pane that the header is being added as sevenseg.h and not sevenSeg.h ... would that matter?

0