I'm using Linux OS (Ubuntu) and I need some recording file from mic. I typed sudo apt-get install libasound2-dev
.
Then, I can find header file in /usr/include/alsa
, but I can't find c file.
I think this is the problem of "undefined reference to 'snd_pcm_open
'".
What can I do?
Asked
Active
Viewed 1,335 times
0

dlmeetei
- 9,905
- 3
- 31
- 38

daewon Kim
- 1
- 2
-
apt-get install on a dev package installs binaries and headers, not the C code. You will need source code separately – dlmeetei Aug 18 '17 at 08:41
-
Possible duplicate of [gcc: undefined reference to](https://stackoverflow.com/questions/22426574/gcc-undefined-reference-to) – CL. Aug 18 '17 at 09:02
-
1You have to link to the alsa library on the command line, I think it is `-lasound` – tay10r Aug 19 '17 at 22:40
-
Yes, "undefined reference" almost always refers to a compiled subroutine, it could even be in the same program, not a piece of source code. Probably a library, maybe another program you compile at the same time. The /opt/vc stuff on a Raspberrry Pi and rtlsdr are infamous for this, your makefile needs to compile several programs besides what you're working on at the same time. – Alan Corey Aug 24 '20 at 23:45
1 Answers
-1
I you want the source code of a libasound2-dev, use the commande
apt-get source libasound2-dev
You might need to install dpkg-dev package.

fraff
- 757
- 6
- 10