SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions on how to get your MSP JTAG programmer up and running.
By fireblade
#6042
I have done a file with funcions to work with LCD, named LCD.c, and a file named LCD.h, with the name of the functions. In the main file I do the #include "LCD.h". When I compile the code, it's ok with no errors or warnings, but when I do make or debug, it does an error saying: Error[e46]: Undefined external "(funtion_name)" referred in main. My question is: Do I have to make any include on LCD.c or in LCD.h? Thanks.
By wiml
#6050
Are you linking the LCD.o file into the final program? The header file just tells the compiler how to call the functions when it finds references to them in main() or wherever. You also need to compile and include the actual functions themselved (that's in LCD.c). Normally the makefile is in charge of compiling main.c to main.o, LCD.c to LCD.o, and then combining main.o and LCD.o into the final program image.
By AishFan
#47310
were you ever able to fix your problem? i am running into the same problem, where only one of my functions gives the undefined external referred in main error. thanks.
By steveduck
#77085
Write the LCD function in LCD.c

void LCD_Write(unsigned char c_
{

}




Add function prototype to LCD.h

void LCD_Write(unsigned char);



in main.c add

#include LCD.H


call LCD_Write('a');


Hope this helps

Steve

MSP430 Field Applications Engineer