Is there any constraint on the pin defination of NUCLEO board to the LCD1602A?

My board is NUCLEO L432kc. I use the TextLCD.h as the lib for the lcd1602, and use the mbed-cli compile the program. The lcd1602 is initilized as follow:

TextLCD lcd(A1, A2, A3, A4, A5, A6, TextLCD::LCD16x2);

And the error information will show up
"undefined reference to TextLCD::TextLCD(PinName, PinName, PinName, PinName, PinName, PinName, TextLCD::LCDType)' $PATH/.gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: CMakeFiles/final_project.dir/main.cpp.obj: in function TextLCD::~TextLCD()’:
$PATH/TextLCD.h:43: undefined reference to `vtable for TextLCD’
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
ERROR: CMake invocation failed!
More information may be available by using the command line option ‘-v’. "
What may be the reason for that?
The link of TextLCD.h are as follows: TextLCD - TextLCD library for controlling various LCD panel… | Mbed

Hi there,

This topic was not visible until today morning and it is somewhere down on the list because it is 5 days old. I pushed it at top by this post.
Someone experienced with Mbed CLI could help??

BR, Jan

Hello Ruijlie,

The TextLCD.h is only a header file declaring variables and functions. It isn’t a complete library. The definition of functions is usually in a *.cpp file(s), like the TextLCD.cpp in this case.
To add a library to your project you have to tell the compiler the location of such *.cpp files. Please issue the command below from the root directory of your project. The --source . argument makes sure your main.cpp is getting compiled too.

mbed compile -t GCC_ARM -m NUCLEO_L432KC --source . --source full_path_to_the_TextLCD.cpp_file