Closed sakunamary closed 2 years ago
Hello, i have not used this IDE. It seems that the order of the header files is incorrect or a header file is not included in any file.
I'm getting the same error with PlatformIO - is there any solution?
I have The seams problem with visual studio code. The program LCDMENULIB2 work perfectly with Arduino code IDE But this much errors Came in compilation process on visual studio code. I'm Very dislike :(. I Thing that The error are in LinkedIn library But no understood like solve that. Can you help me? Thanks a Lot. This is Arduino forum italian Page on i put My code compilation process https://forum.arduino.cc/index.php?topic=657392.0
I have seen that This code have more problems with c/c++ sintax And deployment. I have resolve partial error But Now remain more problem with lcdmenulib-macros.h in macro table definition :( the error is g_LCDML_DISP_lang_lcdml_table' was not declared in this scope and shown on https://forum.arduino.cc/index.php?topic=657657.0
I am able to compile this library using PlatformIO for Teensy LC.
I placed most of the functions from the beginner LCD example into separate .cpp
files along with appropriate header files, for example LCDML_condition.ino
became LCDML_condition.cpp
along with LCDML_condition.h
These files are then placed in /lib/LCDML
and the header files are included in main.cpp
The only issue I ran into was as describe above. To solve that I found I had to place the void lcdml_menu_display()
function in main.cpp
Actually I am using the Arduino IDE and when modifiying the example even the slightest I get the above problem.
OK i have found my problem and it may be yours too as my error was exactly the same. The line under the menu definition
I am able to compile this library using PlatformIO for Teensy LC. I placed most of the functions from the beginner LCD example into separate
.cpp
files along with appropriate header files, for exampleLCDML_condition.ino
becameLCDML_condition.cpp
along withLCDML_condition.h
These files are then placed in/lib/LCDML
and the header files are included inmain.cpp
The only issue I ran into was as describe above. To solve that I found I had to place the
void lcdml_menu_display()
function inmain.cpp
Hey, can you upload the files with the changes you have made? I'm having the same problem and not able to fix it.
I solved this by just combining the contents of all of the .ino files into a single .cpp file and then creating a header file.
For the header file I used a program called makeheaders
(https://www.hwaci.com/sw/mkhdr/) and then commented out everything that wasn't a function declaration (or you can comment everything out, compile, enable the lines to fix the first error, repeat until linking).
I have the same issue .... I don't know how to solve this Problem both terms use things which are declared later in the other term
Here my code:
#include <LCDMenuLib2.h> #define _LCDML_DISP_cfg_cursor 0x7E // cursor Symbol #define _LCDML_DISP_cfg_scrollbar 1 // enable a scrollbar // enable this line (set to 1) to show a header above the first menu element // this function can be changed in LCDML_display_menu tab #define _LCDML_DSIP_use_header 0 /* void lcdml_menu_display(); void lcdml_menu_clear(); void lcdml_menu_control(); */ #include "menuToDisplay.h" //Objekte initialisieren LCDMenuLib2_menu LCDML_0 (255, 0, 0, NULL, NULL); // root menu element (do not change) LCDMenuLib2 LCDML(LCDML_0, _LCDML_DISP_rows-_LCDML_DSIP_use_header, _LCDML_DISP_cols, lcdml_menu_display, lcdml_menu_clear, lcdml_menu_control);
The headerfile menuToDisplay.h:
/* ******************************************************************** */ void lcdml_menu_clear() /* ******************************************************************** */ { lcd.clear(); lcd.setCursor(0, 0); } /* ******************************************************************** */ void lcdml_menu_display() /* ******************************************************************** */ { // update content // *************** if (LCDML.DISP_checkMenuUpdate()) { // clear menu // *************** LCDML.DISP_clear();
........
So I get always errors, no matter what I declared first. Any ideas?
I've got a same issue in vsCode & PlatformIO framework: Arduino platform ESP32
Is any solution already?
I've edited your LCDML_001_liquidCrystal.ino example for platformio (renamed to main.cpp, and included rest of the files as .h after constructor).
src dir: LCDML_condition.h LCDML_control.h LCDML_display_dynFunction.h LCDML_display_menu.h LCDML_display_menuFunction.h main.cpp
main.cpp (edited part): `// // Objects // LCDMenuLib2_menu LCDML_0 (255, 0, 0, NULL, NULL); // root menu element (do not change) LCDMenuLib2 LCDML(LCDML_0, _LCDML_DISP_rows-_LCDML_DSIP_use_header, _LCDML_DISP_cols, lcdml_menu_display, lcdml_menu_clear, lcdml_menu_control);
// // LCDML MENU/DISP // `
(for another try I downloaded the latest lib from github, and overwritten in the libs dir. It's same issue) when I try compile, I got error messages for the lib itself only.
In file included from C:\Users\larry.platformio\lib\LCDMenuLib2\src/LCDMenuLib2.h:183:0, from src\main.cpp:24: src/LCDML_display_menu.h: In function 'void lcdml_menu_display()': C:\Users\larry.platformio\lib\LCDMenuLib2\src/LCDMenuLib2_macros.h:118:29: error: 'g_LCDML_DISP_lang_lcdml_table' was not declared in this scope strcpy(var, g_LCDML_DISPlang ## lang ## _table[id]); \ ^ C:\Users\larry.platformio\lib\LCDMenuLib2\src/LCDMenuLib2_macros.h:138:9: note: in expansion of macro 'LCDML_getCustomContent' LCDML_getCustomContent(lcdml, var, id) ^ src/LCDML_display_menu.h:50:9: note: in expansion of macro 'LCDML_getContent' LCDML_getContent(content_text, LCDML.MENU_getParentID()); ^ C:\Users\larry.platformio\lib\LCDMenuLib2\src/LCDMenuLib2_macros.h:118:29: error: 'g_LCDML_DISP_lang_lcdml_table' was not declared in this scope strcpy(var, g_LCDML_DISPlang ## lang ## _table[id]); \ ^ C:\Users\larry.platformio\lib\LCDMenuLib2\src/LCDMenuLib2_macros.h:138:9: note: in expansion of macro 'LCDML_getCustomContent' LCDML_getCustomContent(lcdml, var, id) ^ src/LCDML_display_menu.h:69:13: note: in expansion of macro 'LCDML_getContent' LCDML_getContent(content_text, tmp->getID()); ^ *** [.pio\build\esp32doit-devkit-v1\src\main.cpp.o] Error 1
extern char\* g_LCDML_DISP_lang_lcdml_table[254];
into a right place in the example code:
`// ============================================================ // Example: LCDML_serialmonitor // ============================================================
[...]
//#define _LCDML_cfg_use_ram
// // includes //
extern char* g_LCDML_DISP_lang_lcdml_table[254];
// U8g2lib
// #include
// // U8GLIB // // U8g2 Constructor List (Frame Buffer) // The complete list is available here: https://github.com/olikraus/u8g2/wiki/u8g2setupcpp // Please update the pin numbers according to your setup. Use U8X8_PIN_NONE if the reset pin is not connected //U8G2_ST7920_128X64_F_HW_SPI u8g2(U8G2_R0, / CS=/ 53, / reset=/ U8X8_PIN_NONE); // (MEGA, ... //U8G2_ST7920_128X64_F_HW_SPI u8g2(U8G2_R0, / CS=/ 12, / reset=/ U8X8_PIN_NONE); // (Uno and co U8G2_ST7920_128X64_F_SW_SPI u8g2(U8G2_R0, / clock=/ 25, / data= /R/w / 33, / CS=/ 32, / reset= / U8X8_PIN_NONE ); // ESP32
// settings for u8g lib and LCD
// font settings
// cursor settings
// menu position and size
// scrollbar width
// nothing change here
// rows and cols // when you use more rows or cols as allowed change in LCDMenuLib.h the define "_LCDML_DISP_cfg_max_rows" and "_LCDML_DISP_cfg_max_string_length" // the program needs more ram with this changes
// // Prototypes // void lcdml_menu_display(); void lcdml_menu_clear(); void lcdml_menu_control();
// // Objects // LCDMenuLib2_menu LCDML_0 (255, 0, 0, NULL, NULL); // root menu element (do not change) LCDMenuLib2 LCDML(LCDML_0, _LCDML_DISP_rows, _LCDML_DISP_cols, lcdml_menu_display, lcdml_menu_clear, lcdml_menu_control);
// // LCDML MENU/DISP // // LCDML_0 => layer 0 // LCDML_0_X => layer 1 // LCDML_0_X_X => layer 2 // LCDML_0_X_X_X => layer 3 // LCDML0... => layer ...
// For beginners // LCDML_add(id, prev_layer, new_num, lang_char_array, callback_function)
[...] `
The example code is added to the lib. Thank you for the pull requests.
I am trying to compile the examples of U8g2 menu in Sloeber,the Eclipse IDE for arduino , but not working . here is the error output :
15:34:03 Incremental Build of configuration Release for project menu2 "E:\sloeber\arduinoPlugin\tools\make\make" all 'Building file: ..\sloeber.ino.cpp' 'Starting C++ compile' "E:\sloeber\arduinoPlugin\packages\arduino\tools\avr-gcc\5.4.0-atmel3.6.1-arduino2/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10802 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -I"E:\sloeber\arduinoPlugin\packages\arduino\hardware\avr\1.6.23\cores\arduino" -I"E:\sloeber\arduinoPlugin\packages\arduino\hardware\avr\1.6.23\variants\mega" -I"E:\sloeber\arduinoPlugin\libraries\LCDMenuLib2\1.3.0\src" -I"E:\sloeber\arduinoPlugin\libraries\U8g2\2.24.3\src" -I"E:\sloeber\arduinoPlugin\packages\arduino\hardware\avr\1.6.23\libraries\SPI\src" -I"E:\sloeber\arduinoPlugin\packages\arduino\hardware\avr\1.6.23\libraries\Wire\src" -MMD -MP -MF"sloeber.ino.cpp.d" -MT"sloeber.ino.cpp.o" -D__IN_ECLIPSE__=1 -x c++ "..\sloeber.ino.cpp" -o "sloeber.ino.cpp.o"
In file included from E:\sloeber\arduinoPlugin\packages\arduino\hardware\avr\1.6.23\cores\arduino/Arduino.h:28:0, from ..\sloeber.ino.cpp:7: ..\LCDML_display_menu.ino: In function 'void lcdml_menu_display()': E:\sloeber\arduinoPlugin\libraries\LCDMenuLib2\1.3.0\src/LCDMenuLib2_macros.h:66:48: error: 'g_LCDML_DISP_lang_table' was not declared in this scope --I think here is the key point.... I have checked the code "LCDMenuLib2_macros.h". strcpy_P(var, (char )pgm_read_word(&(g_LCDML_DISP_lang_table[id]))); \ ^ ..\LCDML_display_menu.ino:66:13: note: in expansion of macro 'LCDML_getContent' LCDML_getContent(content_text, tmp->getID()); ^ In file included from ..\sloeber.ino.cpp:98:0: ..\LCDML_display_menu.ino:35:11: warning: unused variable 'scrollbar_min' [-Wunused-variable] uint8_t scrollbar_min = 0; ^ ..\LCDML_display_menu.ino:38:11: warning: unused variable 'scroll_pos' [-Wunused-variable] uint8_t scroll_pos = ((1.n_max _LCDML_DISP_rows) / (scrollbar_max - 1) scrollbar_cur_pos); ^ subdir.mk:18: recipe for target 'sloeber.ino.cpp.o' failed make: *** [sloeber.ino.cpp.o] Error 1
15:34:07 Build Failed. 3 errors, 9 warnings. (took 3s.759ms)
I have duble checked in Arduino IDE ,the examples project is working ... so could you pls have a look on this issue ...Thanks a lot