hzeller / rpi-rgb-led-matrix

Controlling up to three chains of 64x64, 32x32, 16x32 or similar RGB LED displays using Raspberry Pi GPIO
GNU General Public License v2.0
3.67k stars 1.17k forks source link

undefined reference to `rgb_matrix::RGBMatrix::RequestInputs(unsigned long long)' error #1313

Closed K0rkunc closed 3 years ago

K0rkunc commented 3 years ago

hi im beginner on linux i need ur help :(

integrating ur library my project but i cant work im getting some errors

How to fix that ? im using input-example can u give me sample or help plz

pi@raspberrypi:~/matrix $ gcc -o main main.cpp /usr/bin/ld: /tmp/ccGzawJ5.o: in function main': main.cpp:(.text+0x4c): undefined reference torgb_matrix::RGBMatrix::Options::Options()' /usr/bin/ld: main.cpp:(.text+0x88): undefined reference to rgb_matrix::RGBMatrix::CreateFromFlags(int*, char***, rgb_matrix::RGBMatrix::Options*, rgb_matrix::RuntimeOptions*, bool)' /usr/bin/ld: main.cpp:(.text+0xcc): undefined reference torgb_matrix::RGBMatrix::RequestInputs(unsigned long long)' /usr/bin/ld: main.cpp:(.text+0x190): undefined reference to rgb_matrix::RGBMatrix::AwaitInputChange(int)' /usr/bin/ld: /tmp/ccGzawJ5.o: in function__static_initialization_and_destruction_0(int, int)': main.cpp:(.text+0x2e8): undefined reference to rgb_matrix::RGBMatrix::Options::Options()' /usr/bin/ld: main.cpp:(.text+0x2f0): undefined reference torgb_matrix::RuntimeOptions::RuntimeOptions()' collect2: error: ld returned 1 exit status

hzeller commented 3 years ago

The error you see is that the linker doesn't find the functions defined in the library. Reason is, that it doesn't know that it has to link the library. So you essentially just need to add -L<path-to-the-lib-dir> -lrgbmatrix to the compiler call (with the appropriate path for the lib dir).

In the examples-api-use/ is a section how you can set up your Makefile to link the library.

K0rkunc commented 3 years ago

thank u so much solved

K0rkunc commented 3 years ago

thank u so much solved ,