We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello,
I am trying to convert this simple code to SDCC (due to chaninging to Linux):
// main.c #include <t89c51cc01.h> #include <stdio.h> #include <lcd.h> // my own lcd header file int i = 0; void main() { char txt[17]; lcd_init(); while (1) { lcd_home(); sprintf(txt, "Zahl: %i", i); lcd_send_text(txt); } } void gelb() interrupt 0 { i++; }
The "lcd.h" header:
// LCD header file #ifndef _lcd_H_ #define _lcd_H_ #define DIS_ON_1 2 // to be continued void lcd_init(); void lcd_display(); void lcd_dis_on(unsigned char i); void lcd_dis_off(); void lcd_store(); void lcd_clear(); void lcd_send_char(unsigned char c); void lcd_send_text(char *t); void lcd_position(unsigned char p); void lcd_home(); void lcd_wait(); void lcd_sec(unsigned char i); void lcd_msec(unsigned char i); #endif // _lcd_H_
With Keil, all worked fine. With SDCC, following code:
// main.c #include <mcs51/8051.h> #include <stdio.h> #include <lcd.h> int i = 0; void main() { char txt[17]; lcd_init(); while (1) { lcd_home(); sprintf(txt, "Zahl: %i", i); lcd_send_text(txt); } } void gelb() interrupt 0 { i++; }
I get the following errors:
?ASlink-Warning-Undefined Global '_lcd_home' referenced by module 'main' ?ASlink-Warning-Undefined Global '_lcd_init' referenced by module 'main' ?ASlink-Warning-Undefined Global '_lcd_send_text' referenced by module 'main'
It creates the .ihx file, tho...
Can anyone of you figure out what's wrong? I hope this is the right place to ask...
Thanks in advance =)
No, it isn't: it is the Keil forum - for discussions about Keil products.
For SDCC questions, you obviously need to go to the SDCC forum!
"Can anyone of you figure out what's wrong?"
The error messages explicitly tell you exactly what's wrong: the global symbols '_lcd_home', '_lcd_init', and '_lcd_send_text' are not defined!
(that is a basic 'C' programming issue - nothing specifically to do with either Keil or SDCC)
www.lmgtfy.com