I cant compile example programs that use rawmidi.
When I look on my harddrive, I have many rawmidi.h files, but since 2015 they are all 0 bytes. Can that be the reason I cant compile. But why is those files 0 bytes from the repository Im using?
I get the following error messages...
test.c:(.text+0x507): undefined reference to `snd_rawmidi_open' test.c:(.text+0x5d8): undefined reference to `snd_rawmidi_open' test.c:(.text+0x75e): undefined reference to `snd_rawmidi_read' test.c:(.text+0x846): undefined reference to `snd_rawmidi_write' test.c:(.text+0x867): undefined reference to `snd_rawmidi_write' test.c:(.text+0x888): undefined reference to `snd_rawmidi_write' test.c:(.text+0x894): undefined reference to `snd_rawmidi_drain' test.c:(.text+0x8c1): undefined reference to `snd_rawmidi_write' test.c:(.text+0x8e2): undefined reference to `snd_rawmidi_write' test.c:(.text+0x903): undefined reference to `snd_rawmidi_write' test.c:(.text+0x90f): undefined reference to `snd_rawmidi_drain' test.c:(.text+0xa71): undefined reference to `snd_rawmidi_read' test.c:(.text+0xae0): undefined reference to `snd_rawmidi_write' test.c:(.text+0xaec): undefined reference to `snd_rawmidi_drain' test.c:(.text+0xb8f): undefined reference to `snd_rawmidi_drain' test.c:(.text+0xb9b): undefined reference to `snd_rawmidi_close' test.c:(.text+0xbaf): undefined reference to `snd_rawmidi_drain' test.c:(.text+0xbbb): undefined reference to `snd_rawmidi_close'
Hi,
On Dec 27 2015 15:29, Daniel Viksporre wrote:
I cant compile example programs that use rawmidi.
When I look on my harddrive, I have many rawmidi.h files, but since 2015 they are all 0 bytes. Can that be the reason I cant compile. But why is those files 0 bytes from the repository Im using?
I get the following error messages...
test.c:(.text+0x507): undefined reference to `snd_rawmidi_open' test.c:(.text+0x5d8): undefined reference to `snd_rawmidi_open' test.c:(.text+0x75e): undefined reference to `snd_rawmidi_read' test.c:(.text+0x846): undefined reference to `snd_rawmidi_write' test.c:(.text+0x867): undefined reference to `snd_rawmidi_write' test.c:(.text+0x888): undefined reference to `snd_rawmidi_write' test.c:(.text+0x894): undefined reference to `snd_rawmidi_drain' test.c:(.text+0x8c1): undefined reference to `snd_rawmidi_write' test.c:(.text+0x8e2): undefined reference to `snd_rawmidi_write' test.c:(.text+0x903): undefined reference to `snd_rawmidi_write' test.c:(.text+0x90f): undefined reference to `snd_rawmidi_drain' test.c:(.text+0xa71): undefined reference to `snd_rawmidi_read' test.c:(.text+0xae0): undefined reference to `snd_rawmidi_write' test.c:(.text+0xaec): undefined reference to `snd_rawmidi_drain' test.c:(.text+0xb8f): undefined reference to `snd_rawmidi_drain' test.c:(.text+0xb9b): undefined reference to `snd_rawmidi_close' test.c:(.text+0xbaf): undefined reference to `snd_rawmidi_drain' test.c:(.text+0xbbb): undefined reference to `snd_rawmidi_close'
Can you show command lines to compile your 'test.c'?
Regards
Takashi Sakamoto
Daniel Viksporre wrote:
test.c:(.text+0x507): undefined reference to `snd_rawmidi_open'
This message comes from the linker.
If the compiler itself does not complain, then you have no problem with rawmidi.h.
The linker error is probably caused by not linking with the ALSA library; add -lasound to the compiler command.
Regards, Clemens
2015-12-27 9:18 GMT+01:00, Clemens Ladisch clemens@ladisch.de:
Daniel Viksporre wrote:
test.c:(.text+0x507): undefined reference to `snd_rawmidi_open'
This message comes from the linker.
If the compiler itself does not complain, then you have no problem with rawmidi.h.
The linker error is probably caused by not linking with the ALSA library; add -lasound to the compiler command.
Regards, Clemens
I compiled with... gcc -lasound test.c
I have tried with many different code examples that I have found on the internet, and error messages stays about the same.
// Daniel
On Dec 28 2015 00:22, Daniel Viksporre wrote:
2015-12-27 9:18 GMT+01:00, Clemens Ladisch clemens@ladisch.de:
Daniel Viksporre wrote:
test.c:(.text+0x507): undefined reference to `snd_rawmidi_open'
This message comes from the linker.
If the compiler itself does not complain, then you have no problem with rawmidi.h.
The linker error is probably caused by not linking with the ALSA library; add -lasound to the compiler command.
Regards, Clemens
I compiled with... gcc -lasound test.c
I have tried with many different code examples that I have found on the internet, and error messages stays about the same.
I think cause is the position of linker option. Let's try: $ gcc test.c -lasound
Regards
Takashi Sakamoto
Hi there
Takashi Sakamoto wrote:
I think cause is the position of linker option. Let's try: $ gcc test.c -lasound
On my box the snd_rawmidi_ stuff is in /usr/include/alsa/rawmidi.h /usr/include/alsa/asoundlib.h includes alsa/rawmidi.h, so a #include <alsa/asoundlib.h> in the c file should do.
I compile with cc -Wall -lasound -o foo foo.c
Hope this helps.
Regards, Rob
Hi there
Rob van der Putten wrote:
On my box the snd_rawmidi_ stuff is in /usr/include/alsa/rawmidi.h /usr/include/alsa/asoundlib.h includes alsa/rawmidi.h, so a #include <alsa/asoundlib.h> in the c file should do.
I compile with cc -Wall -lasound -o foo foo.c
Actually cc -Wall -O2 -lasound -o foo foo.c
Hope this helps.
Regards, Rob
participants (4)
-
Clemens Ladisch
-
Daniel Viksporre
-
Rob van der Putten
-
Takashi Sakamoto