boochow / pico_test_projects

Some projects to test Raspberry Pi Pico unique functionalities, such as interpolators or scanvideo library.
MIT License
87 stars 7 forks source link

undefined reference to `tud_midi_n_read' #3

Open schollz opened 1 year ago

schollz commented 1 year ago

These examples are an incredible resource. Thank you so much for making them available and sharing them.

I have a question for anyone out there - I'm having a problem building usb-midi:

[ 90%] Linking CXX executable usb-midi.elf
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: CMakeFiles/usb-midi.dir/usb_midi.c.obj: in function `midi_task':
usb_midi.c:(.text.midi_task+0x24): undefined reference to `tud_midi_n_read'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/usb-midi.dir/build.make:1143: usb-midi.elf] Error 1
make[2]: Leaving directory '/home/zns/Documents/pico_test_projects/usb-midi/build'
make[1]: *** [CMakeFiles/Makefile2:1491: CMakeFiles/usb-midi.dir/all] Error 2
make[1]: Leaving directory '/home/zns/Documents/pico_test_projects/usb-midi/build'
make: *** [Makefile:91: all] Error 2
make: Leaving directory '/home/zns/Documents/pico_test_projects/usb-midi/build'

Is this because of TinyUSB? Is there someting I'm supposed to install before running?

I got this error from running

cmake -B build
make -C build
AndrewDyet commented 1 year ago

I also received this error, would love a fix or workaround!

h-takeyeah commented 10 months ago

Try doing :wrench: https://github.com/boochow/pico_test_projects/blob/5424d9b919b471bdbbd042cfc434722acbd218b1/usb-midi/usb_midi.c#L91

- if (n_data = tud_midi_n_read(0, 0, msg, 3)) {
+ if (n_data = tud_midi_n_stream_read(0, 0, msg, 3)) {

note

I am using TinyUSB at commit 86c416d4c0fb38432460b3e11b08b9de76941bf5, and these functions (but tud_midi_n_read has already been removed) declared here midi_device.h#L67.