libcdio-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Libcdio-help] Undefined references on compilation


From: Rocky Bernstein
Subject: Re: [Libcdio-help] Undefined references on compilation
Date: Mon, 9 Aug 2010 17:34:26 -0400

The error messages indicate that you did not link with the libcdio library.

If the command
   pkg-config libcdio --libs

works and returns something, then add that string on to the ld command (which is usually done under the covers say from gcc). Here's an example:

$ pkg-config libcdio --libs
-L/usr/local/lib -lcdio -lm 
$ cd llibcdio/example/
$ ls
audio.c ...
$ gcc audio.c `pkg-config libcdio --libs` -o audio
$

If pkg-config isn't around, then locate where libcdio.a library archive exists on your computer. And give that as file in the linking. Here's an example of that, again using gcc as an example

 $ locate libcdio.a
/usr/local/lib/libcdio.a
..
$ gcc audio.c  /usr/local/lib/libcdio.a -o audio
$

In the example above  -L /usr/local/lib and -lcdio would also work.

On Mon, Aug 9, 2010 at 5:22 PM, Trevor Vallender <address@hidden> wrote:
Sorry this is a bit of a basic question I think, but I'm using libcdio
in my first real C app.

I am trying to compile the second example from the documentation, have
used #include <cdio/cdio.h>, but when I compile I receive:

/tmp/ccGMMKAB.o: In function `main':
cdio.c:(.text+0x19): undefined reference to `cdio_open'
cdio.c:(.text+0x30): undefined reference to `cdio_get_driver_name'
cdio.c:(.text+0x4d): undefined reference to `cdio_get_default_device'
cdio.c:(.text+0x6a): undefined reference to `cdio_destroy'
cdio.c:(.text+0x8e): undefined reference to `cdio_have_driver'
cdio.c:(.text+0x9e): undefined reference to `cdio_driver_describe'
cdio.c:(.text+0xbd): undefined reference to `cdio_driver_describe'
collect2: ld returned 1 exit status

What am I doing wrong? Is there some extra option I must pass to gcc?

Regards,
Trevor Vallender



_______________________________________________
Libcdio-help mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/libcdio-help


reply via email to

[Prev in Thread] Current Thread [Next in Thread]