This is a cache of https://discuss.96boards.org/t/linker-error-undefined-reference-to-upm-jhd1313m1/8877. It is a snapshot of the page at 2021-06-06T14:22:11.865+0000.
Linker error: <strong>undefined</strong> reference to upm::Jhd1313m1 - DragonBoard410c - 96Boards Forum

Linker error: undefined reference to upm::Jhd1313m1

I am new and attending ucsd course at coursera.
I am using debian console version. I have updated and upgraded all libraries in my device.
In some of their examples they try to operate the LCD with a c++ code ‘magic_8_ball’
When I try to make the output file this error come to me

undefined reference to upm::Jhd1313m1

plus with the function name inside the class.
I know this error is a linker error and if it can’t find the source or object file of jhd1313m1 it will give this error. Or if there is a naming difference.
I searched for jhd1313m1 in my device in only find two of them: jhd1313m1.hpp and jhd1313m1.h only. no .o is found.

What could be wrong?

Probably you forgot to link the library to your program.

Scroll down to “Step 3” where it says;
$ g++ rgb_lcd_demo.cpp -o rgb_lcd_demo -g -Wall -lupm-i2clcd

My guess is you left out the “-lupm-i2clcd” part, right?

It is already in the linker flag in the Makefile. And it is:

-lupm-lcd

I have seen this before… the -lupm-lcd flag needs to be at the end of the link command, but the makefile has it at the beginning. Just move the position of the flag and it will link.

Nothing occur, still the same error.

Can you share logs from the build (e.g. allow everyone to see exactly the command line and the associated error)?

The source link

/usr/bin/ld: /tmp/cceLD2fy.o: in function `main':
magic8.cpp:(.text+0x50): undefined reference to `upm::Jhd1313m1::Jhd1313m1(int, int, int)'
/usr/bin/ld: magic8.cpp:(.text+0x5c): undefined reference to `upm::Jhd1313m1::clear()'
/usr/bin/ld: magic8.cpp:(.text+0x70): undefined reference to `upm::Jhd1313m1::setColor(unsigned char, unsigned char, unsigned char)'
/usr/bin/ld: magic8.cpp:(.text+0x80): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0xb4): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0xd4): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0x108): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0x1dc): undefined reference to `upm::Jhd1313m1::clear()'
/usr/bin/ld: magic8.cpp:(.text+0x1f0): undefined reference to `upm::Jhd1313m1::setColor(unsigned char, unsigned char, unsigned char)'
/usr/bin/ld: magic8.cpp:(.text+0x200): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0x234): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0x250): undefined reference to `upm::Jhd1313m1::clear()'
/usr/bin/ld: magic8.cpp:(.text+0x264): undefined reference to `upm::Jhd1313m1::setColor(unsigned char, unsigned char, unsigned char)'
/usr/bin/ld: magic8.cpp:(.text+0x274): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0x2a8): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0x2c4): undefined reference to `upm::Jhd1313m1::clear()'
/usr/bin/ld: magic8.cpp:(.text+0x2d8): undefined reference to `upm::Jhd1313m1::setColor(unsigned char, unsigned char, unsigned char)'
/usr/bin/ld: magic8.cpp:(.text+0x2e8): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0x31c): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0x33c): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0x370): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0x38c): undefined reference to `upm::Jhd1313m1::clear()'
/usr/bin/ld: magic8.cpp:(.text+0x3a0): undefined reference to `upm::Jhd1313m1::setColor(unsigned char, unsigned char, unsigned char)'
/usr/bin/ld: magic8.cpp:(.text+0x3b0): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0x3e4): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0x404): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0x438): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0x454): undefined reference to `upm::Jhd1313m1::clear()'
/usr/bin/ld: magic8.cpp:(.text+0x468): undefined reference to `upm::Jhd1313m1::setColor(unsigned char, unsigned char, unsigned char)'
/usr/bin/ld: magic8.cpp:(.text+0x478): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0x4ac): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0x4cc): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0x500): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0x51c): undefined reference to `upm::Jhd1313m1::clear()'
/usr/bin/ld: magic8.cpp:(.text+0x530): undefined reference to `upm::Jhd1313m1::setColor(unsigned char, unsigned char, unsigned char)'
/usr/bin/ld: magic8.cpp:(.text+0x540): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0x574): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0x590): undefined reference to `upm::Jhd1313m1::clear()'
/usr/bin/ld: magic8.cpp:(.text+0x5a4): undefined reference to `upm::Jhd1313m1::setColor(unsigned char, unsigned char, unsigned char)'
/usr/bin/ld: magic8.cpp:(.text+0x5b4): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0x5e8): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0x604): undefined reference to `upm::Jhd1313m1::clear()'
/usr/bin/ld: magic8.cpp:(.text+0x618): undefined reference to `upm::Jhd1313m1::setColor(unsigned char, unsigned char, unsigned char)'
/usr/bin/ld: magic8.cpp:(.text+0x628): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0x65c): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0x67c): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0x6b0): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0x6cc): undefined reference to `upm::Jhd1313m1::clear()'
/usr/bin/ld: magic8.cpp:(.text+0x6e0): undefined reference to `upm::Jhd1313m1::setColor(unsigned char, unsigned char, unsigned char)'
/usr/bin/ld: magic8.cpp:(.text+0x6f0): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0x724): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0x740): undefined reference to `upm::Jhd1313m1::clear()'
/usr/bin/ld: magic8.cpp:(.text+0x754): undefined reference to `upm::Jhd1313m1::setColor(unsigned char, unsigned char, unsigned char)'
/usr/bin/ld: magic8.cpp:(.text+0x764): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0x798): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0x7b4): undefined reference to `upm::Jhd1313m1::clear()'
/usr/bin/ld: magic8.cpp:(.text+0x7c8): undefined reference to `upm::Jhd1313m1::setColor(unsigned char, unsigned char, unsigned char)'
/usr/bin/ld: magic8.cpp:(.text+0x7d8): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0x80c): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0x82c): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0x860): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0x87c): undefined reference to `upm::Jhd1313m1::clear()'
/usr/bin/ld: magic8.cpp:(.text+0x890): undefined reference to `upm::Jhd1313m1::setColor(unsigned char, unsigned char, unsigned char)'
/usr/bin/ld: magic8.cpp:(.text+0x8a0): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0x8d4): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0x8f0): undefined reference to `upm::Jhd1313m1::clear()'
/usr/bin/ld: magic8.cpp:(.text+0x904): undefined reference to `upm::Jhd1313m1::setColor(unsigned char, unsigned char, unsigned char)'
/usr/bin/ld: magic8.cpp:(.text+0x914): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0x948): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0x968): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0x99c): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0x9b8): undefined reference to `upm::Jhd1313m1::clear()'
/usr/bin/ld: magic8.cpp:(.text+0x9cc): undefined reference to `upm::Jhd1313m1::setColor(unsigned char, unsigned char, unsigned char)'
/usr/bin/ld: magic8.cpp:(.text+0x9dc): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0xa10): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0xa30): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0xa64): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0xa80): undefined reference to `upm::Jhd1313m1::clear()'
/usr/bin/ld: magic8.cpp:(.text+0xa94): undefined reference to `upm::Jhd1313m1::setColor(unsigned char, unsigned char, unsigned char)'
/usr/bin/ld: magic8.cpp:(.text+0xaa4): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0xad8): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0xaf8): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0xb2c): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0xb48): undefined reference to `upm::Jhd1313m1::clear()'
/usr/bin/ld: magic8.cpp:(.text+0xb5c): undefined reference to `upm::Jhd1313m1::setColor(unsigned char, unsigned char, unsigned char)'
/usr/bin/ld: magic8.cpp:(.text+0xb6c): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0xba0): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0xbbc): undefined reference to `upm::Jhd1313m1::clear()'
/usr/bin/ld: magic8.cpp:(.text+0xbd0): undefined reference to `upm::Jhd1313m1::setColor(unsigned char, unsigned char, unsigned char)'
/usr/bin/ld: magic8.cpp:(.text+0xbe0): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0xc14): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0xc30): undefined reference to `upm::Jhd1313m1::clear()'
/usr/bin/ld: magic8.cpp:(.text+0xc44): undefined reference to `upm::Jhd1313m1::setColor(unsigned char, unsigned char, unsigned char)'
/usr/bin/ld: magic8.cpp:(.text+0xc54): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0xc88): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0xca4): undefined reference to `upm::Jhd1313m1::clear()'
/usr/bin/ld: magic8.cpp:(.text+0xcb8): undefined reference to `upm::Jhd1313m1::setColor(unsigned char, unsigned char, unsigned char)'
/usr/bin/ld: magic8.cpp:(.text+0xcc8): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0xcfc): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0xd18): undefined reference to `upm::Jhd1313m1::clear()'
/usr/bin/ld: magic8.cpp:(.text+0xd2c): undefined reference to `upm::Jhd1313m1::setColor(unsigned char, unsigned char, unsigned char)'
/usr/bin/ld: magic8.cpp:(.text+0xd3c): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0xd70): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: magic8.cpp:(.text+0xd90): undefined reference to `upm::Jhd1313m1::setCursor(int, int)'
/usr/bin/ld: magic8.cpp:(.text+0xdc4): undefined reference to `upm::Jhd1313m1::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
collect2: error: ld returned 1 exit status
make: *** [Makefile:8: magic8] Error 1

I can’t quite get my head around this.

The source you shared in your recent post links against upm-i2clcd so you should be getting does not exist warnings because this library was split up.

How did you end up linking against upm-lcd? Either way, the jhd1313m1 driver was moved to upm-jhd1313m1 so that is what you need to link against.

Ok, sorry about that, yes the source is from the course and it uses -lupm-i2clcd. I changed it in my local Makefile to -lupm-lcd.

Either way, the jhd1313m1 driver was moved to upm-jhd1313m1 so that is what you need to link against

It worked using upm-jhd1313m1.
I should read the upm documentation update deeply next time. thaank you.

One more question, I searched for a change log for your suggestion. I couldn’t find it in any change log of upm.
I may conclude it implicitly only from
http://iotdk.intel.com/docs/master/upm/group__display.html

Best regards

Try the git history: