Pico display - Some functions inform error under C++

Hello,
I was able to compile all the PIMORONI demos in the PC, without any problem. I have the pico display.

Now, I tried to add some information to the “pico Display” with C++; but if I used some functions, I got errors inside the pico_graphics.cpp code. I used as basic code the BLINK.CPP (it works) and I added code from demo.cpp .

For example if I call the function pico_display.clear(); the error is:
In file: pico_graphics.cpp , line 70 Rect clipped = r.intersection(clip);
the compile/link error is:
undefined reference to `pimoroni::Rect::intersection(pimoroni::Rect const&) const link

For example if I call the function pico_display.triangle(Point(50, 50), Point(130, 80), Point(80, 110)); " the compile error is:
In file: pico_graphics.cpp , line 182 ->triangle_bounds = clip.intersection(triangle_bounds);<-
the compile/link error is:
undefined reference to `pimoroni::Rect::intersection(pimoroni::Rect const&) const’link

For example if I call the function pico_display.line(Point(50, 50), Point(120, 80)); "
In file: pico_graphics.cpp , line 47 → if(!clip.contains(p)) return; ←
the compile /link error is:
undefined reference to `pimoroni::Rect::contains(pimoroni::Point const&) const’link

Some functions works , for example:
using namespace pimoroni;
uint16_t buffer[PicoDisplay::WIDTH * PicoDisplay::HEIGHT];
PicoDisplay pico_display(buffer);
std::vector shapes;
pico_display.init();
pico_display.set_backlight(100);
pico_display.set_pen (0,0,255) ;
pico_display.set_led(0, 0 ,255 );
pico_display.update();

I used the following folders driver/st7789/ ; libraries/pico_display/ ; libraries/pico_graphics/ and the file blink.cpp (from Pi Pico demo) with some lines of PIMORONI demo for Pico Display.

Please, anybody has a suggestion about which is the problem or the missing file ?.

Thanks in advance.
Carlos

The Rect::intersection stuff comes from pico_graphics, which should be built right into the pico_display library - how are you building this, what’s your CMakeList.txt like?

Hello.
Thanks for your help.

The project has only the blink.cpp and CMakeLists.txt files.

The files have the following organization:

blink.cpp

(From GITHUB))
pimoroni-pico–+
-------------------- common
-------------------- drivers --+
-------------------- -------------- st7789
-------------------- libraries --+
-------------------- --------------pico_display
-------------------- --------------pico_graphics

My CMakeLists.txt is:

cmake_minimum_required(VERSION 3.20)
include($ENV{PICO_SDK_PATH}/pico_sdk_init.cmake)
set(SHARED_INCLUDES
F:/PICO_COD/cmdisplay07/pimoroni-pico
C:/VSARM/Pico/pico-sdk/src/rp2_common/hardware_spi/include
C:/VSARM/Pico/pico-sdk/src/rp2_common/hardware_gpio/include
F:/PICO_COD/cmdisplay07/pimoroni-pico/libraries/pico_graphics
F:/PICO_COD/cmdisplay07/pimoroni-pico/libraries/pico_display
F:/PICO_COD/cmdisplay07/pimoroni-pico/drivers/st7789
)
include_directories(${SHARED_INCLUDES})

project(blink C CXX ASM)

VERSIONES

set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)

Inicializar el SDK

pico_sdk_init()

add_executable (blink
blink.cpp
)
pico_add_extra_outputs(${PROJECT_NAME})

target_link_libraries(
${PROJECT_NAME}
pico_stdlib
hardware_spi
hardware_pwm
hardware_dma
) // Here is missing one library !!

Thanks for your help.

Hello ahnlak,
Thanks for your help.

The problem was into the CMakeList.txt file.

The right line for the LINK is:

target_link_libraries(${PROJECT_NAME} pico_stdlib hardware_spi hardware_pwm hardware_dma pico_display)

Best Regards
Carlos