Results 1 to 3 of 3

Thread: [C++] libvorbis Linking Error

  1. #1
    Join Date
    May 2008
    Beans
    1,029

    Question [C++] libvorbis Linking Error

    I'm trying to figure out how to decode an Ogg audio file using libvorbis but the compiler seems to be having trouble linking:

    I don't know if this code is even close to correct, but I can't use any of the initialization functions listed at http://xiph.org/vorbis/doc/vorbisfil...alization.html.

    dog.ogg:
    PHP Code:
    #include <vorbis/vorbisfile.h>
    #include <iostream>
    using namespace std;

    int main()
    {
        
    OggVorbis_File vf;
        
    FILE *infile;
        
    infile fopen("dog.ogg""rb");
        if (
    ov_open_callbacks(infile, &vfNULL0OV_CALLBACKS_DEFAULT) < 0)
        {
            
    cout << "Not Vorbis file" << endl;
            
    fclose(infile);
            return 
    1;
        }
        else
        {
            
    cout << "Vorbis file" << endl;
            
    fclose(infile);
            return 
    0;
        }

    Code:
    $ g++ dog.cpp -o dog -lvorbis
    /tmp/ccltgL15.o: In function `main':
    dog.cpp:(.text+0xb8): undefined reference to `ov_open_callbacks'
    collect2: ld returned 1 exit status

  2. #2
    Join Date
    Oct 2007
    Beans
    1,914
    Distro
    Lubuntu 12.10 Quantal Quetzal

    Re: [C++] libvorbis Linking Error

    The function "ov_open_callbacks" is in the library "libvorbisfile" and not "libvorbis". Thus, you need to link that to your program (as well).

  3. #3
    Join Date
    May 2008
    Beans
    1,029

    Re: [C++] libvorbis Linking Error

    Thanks.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •