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

i cant compile my c++ program with the api #1465

Closed hannescam closed 2 years ago

hannescam commented 2 years ago

hello, i want to make a timer with the c++ api of this project the code: `#include "led-matrix.h"

using rgb_matrix::RGBMatrix;

int main(int argc, char *argv) { RGBMatrix::Options my_defaults; my_defaults.hardware_mapping = "regular"; my_defaults.chain_length = 1; my_defaults.cols = 64; my_defaults.rows = 64; my_defaults.show_refresh_rate = true; rgb_matrix::RuntimeOptions runtime_defaults; runtime_defaults.drop_privileges = 1; RGBMatrix matrix = RGBMatrix::CreateFromFlags(&argc, &argv, &my_defaults, &runtime_defaults); if (matrix == NULL) { PrintMatrixFlags(stderr, my_defaults, runtime_defaults); return 1; } delete matrix; }`

could anyone help me thankyou

the command to compile: pi@led-panel:~/rpi-rgb-led-matrix/include $ g++ test.cpp -o test

the error: /usr/bin/ld: /tmp/ccPlx9WR.o: in function main': test.cpp:(.text+0x14): undefined reference torgb_matrix::RGBMatrix::Options::Options()' /usr/bin/ld: test.cpp:(.text+0x48): undefined reference to rgb_matrix::RuntimeOptions::RuntimeOptions()' /usr/bin/ld: test.cpp:(.text+0x68): undefined reference torgb_matrix::RGBMatrix::CreateFromFlags(int*, char**, rgb_matrix::RGBMatrix::Options, rgb_matrix::RuntimeOptions, bool)' /usr/bin/ld: test.cpp:(.text+0x90): undefined reference to `rgb_matrix::PrintMatrixFlags(_IO_FILE, rgb_matrix::RGBMatrix::Options const&, rgb_matrix::RuntimeOptions const&)' collect2: error: ld returned 1 exit status

and i am on a pi3 b+ with 64 bit raspbian and all examples work

hannescam commented 2 years ago

i solved the issue with a other compiling command: g++ test.cpp -o test.o -Wall -O3 -g -Wextra -Wno-unused-parameter -I. -c && g++ test.o -o test -L ../lib/ -l rgbmatrix -lrt -lm -lpthread