Skip to contentSkip to conversation

Problem to compile : Undefined reference

DISCUSSION Nyx 3 participants 5 messages Feb 28, 2007 – Mar 1, 2007

lore
Share & tools
lore

Nyx

author
#0 lore raw

Hi,

I want to develop some applications (VUmeter and Peakmeter) with ALSA-API. So, I tried to compile an example from
http://equalarea.com/paul/alsa-audio.html#playex but I have some errors like : "
example.o(.text+0x30c): In function `main':
: undefined reference to snd_strerror' example.o(.text+0x340): In function main':
: undefined reference to `snd_pcm_close'
[..]"

Do you have an idea where these errors come from ?

Thank you

Signature · 7 lines
Ker

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
#1 lore raw

That would indicate that you are not linking against libasound

does your compile statement include the line

-lasound, ie:

gcc -o myapp myapp.c -lasound

-----Original Message-----
From: [email protected] on behalf of Nyx
Sent: Wed 2/28/2007 6:03 AM
To: alsa-devel
Subject: [Alsa-devel] Problem to compile : Undefined reference

Hi,

I want to develop some applications (VUmeter and Peakmeter) with ALSA-API. So, I tried to compile an example from
http://equalarea.com/paul/alsa-audio.html#playex but I have some errors like : "
example.o(.text+0x30c): In function `main':
: undefined reference to snd_strerror' example.o(.text+0x340): In function main':
: undefined reference to `snd_pcm_close'
[..]"

Do you have an idea where these errors come from ?

Thank you

Signature · 11 lines
Ker

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

#2 lore raw
In reply to Nyx

2007/2/28, Nyx <[email protected]>:

Quoted 11 lines

I want to develop some applications (VUmeter and Peakmeter) with ALSA-API. So, I tried to compile an example from
http://equalarea.com/paul/alsa-audio.html#playex but I have some errors like : "
example.o(.text+0x30c): In function `main':
: undefined reference to snd_strerror' example.o(.text+0x340): In function main':
: undefined reference to `snd_pcm_close'
[..]"

Do you have an idea where these errors come from ?

You have to link your program with the ALSA library. For instance:

gcc -lasound -Wall -o myprog myprog.c

Of course, ALSA development files must be installed.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

author
#3 lore raw

Thank you.

It works now...

I work with Code::Block. Which IDE do you use ?

--
Ker

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#4 lore raw

sigh;

the reason i/we where able to answer question is because i *dont* let an ide do my thinking for me.

believe me i understand the benefits (i started coding with M$FT QuickBasic and wrote portions of M$FT Platform Builder V3), but i really urge you to actually try using the command line to compile and link stuff, it helps you understand a lot of things.

-----Original Message-----
From: [email protected] on behalf of Nyx
Sent: Thu 3/1/2007 12:52 AM
To: alsa-devel
Subject: Re: [Alsa-devel] Problem to compile : Undefined reference

Thank you.

It works now...

I work with Code::Block. Which IDE do you use ?

--
Ker

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel