hi there
I'm trying to implement st7920 lcd using m328p but having stupid error unbeatable!!
any suggestion?
P.S: code works well under arduino. but in atmel studio.
here is minimal code:
/* * GccApplication4.cpp * * Created: 2/17/2021 1:51:34 PM * Author : MJT */ #define F_CPU 8000000UL #include <Arduino.h> #include <avr/io.h> #include <avr/pgmspace.h> #include "ST7920_SPI.h" #include "SPI.h" #include "avrlibdefs.h" #include "logo-contact.h" // from PropFonts library #include "c64enh_font.h" ST7920_SPI lcd(PIND5); int main(void) { /* Replace with your application code */ while (1) { } }
and error :
Severity Code Description Project File Line
Error ld returned 1 exit status GccApplication4 collect2.exe 0
Error recipe for target 'GccApplication4.elf' failed GccApplication4 c:\users\mjt\Documents\Atmel Studio\7.0\GccApplication4\GccApplication4\Debug\Makefile 108
Error undefined reference to `ST7920_SPI::ST7920_SPI(unsigned char)' GccApplication4 c:\users\mjt\Documents\Atmel Studio\7.0\GccApplication4\GccApplication4\main.cpp 20
Warning narrowing conversion of '-7' from 'int' to 'uint8_t {aka unsigned char}' inside { } is ill-formed in C++11 [-Wnarrowing] GccApplication4 C:\Users\MJT\Documents\Atmel Studio\7.0\GccApplication4\GccApplication4\New folder\c64enh_font.h 123
Warning extra tokens at end of #ifndef directive GccApplication4 C:\Users\MJT\Documents\Atmel Studio\7.0\GccApplication4\GccApplication4\New folder\logo-contact.h 9
Warning missing whitespace after the macro name GccApplication4 C:\Users\MJT\Documents\Atmel Studio\7.0\GccApplication4\GccApplication4\New folder\logo-contact.h 10
Warning non-static data member initializers only available with -std=c++11 or -std=gnu++11 GccApplication4 C:\Users\MJT\Documents\Atmel Studio\7.0\GccApplication4\GccApplication4\New folder\ST7920_SPI.h 122
Warning non-static data member initializers only available with -std=c++11 or -std=gnu++11 GccApplication4 C:\Users\MJT\Documents\Atmel Studio\7.0\GccApplication4\GccApplication4\New folder\ST7920_SPI.h 123
Warning non-static data member initializers only available with -std=c++11 or -std=gnu++11 GccApplication4 C:\Users\MJT\Documents\Atmel Studio\7.0\GccApplication4\GccApplication4\New folder\ST7920_SPI.h 124
Warning non-static data member initializers only available with -std=c++11 or -std=gnu++11 GccApplication4 C:\Users\MJT\Documents\Atmel Studio\7.0\GccApplication4\GccApplication4\New folder\ST7920_SPI.h 146
and here is abbr working code from imported sketch:
#include <Arduino.h> #include <avr/sfr_defs.h> #include "ST7920_SPI.h" #include "SPI.h" #include "avrlibdefs.h" #include "logo-contact.h" // from PropFonts library #include "c64enh_font.h" ST7920_SPI lcd(PIND5); . . . .