Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: how on earth does one use libvorbis? (Read 4677 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

how on earth does one use libvorbis?

Hi all,

I'm trying to write a simple app that gets bitrate, length, etc info from ogg files, so I downloaded libvorbis, extracted it and put it in a folder.

In my VC++ code, I included the necessary header files and such, but when I compiled it, I ended up with errors saying "unexpected end of file while looking for precompiled header directive". Not really knowing what this is, I changed the project properties to "Not using precompiled header files".

But after this, I'm given linker errors (LNK2019: unresolved external symbol...) for each function I'm calling from libvorbis.

I figured the linker has trouble finding the definitions of functions, and tried everything within my knowledge (ie. adding Additional Include Directories in the project properties, adding files under the Source Files folder in the project, etc),
but I keep getting LNK2019 errors.

Can anyone pinpoint me what I'm doing wrong? I'm at the end of my knowledge.
With all the folders, files and whatnot that comes with libvorbis, I'm quite clueless what I'm supposed to do. Am I supposed to compile something first in the library and then use it?

Thanks in advance for any input!

how on earth does one use libvorbis?

Reply #1
Did you check the examples/samples provided on Xiph.org?
They've been quite helpful to me. But then I don't use VC++, rather gcc.

Edit: typo

how on earth does one use libvorbis?

Reply #2
Did you add the vorbis libs to the library list?

how on earth does one use libvorbis?

Reply #3
Quote
In my VC++ code, I included the necessary header files and such, but when I compiled it, I ended up with errors saying "unexpected end of file while looking for precompiled header directive". Not really knowing what this is, I changed the project properties to "Not using precompiled header files".


Correct way of doing this (because the files are not .cpp in Visual C, where you have to include "stdafx.h" at the top).

Quote
But after this, I'm given linker errors (LNK2019: unresolved external symbol...) for each function I'm calling from libvorbis.


As Garf said add the .lib file to your project, also when you include the vorbis headers use:

extern "C" {
#include "somevorbisheader.h"
}

as they are .c files not .cpp

I think that will fix it.

 

how on earth does one use libvorbis?

Reply #4
Your project should include the project files for the static (or dynamic if you prefer) libs of ogg, vorbis and vorbisfile; and should be dependent on all of them. You will need to provide the paths to the 'ogg/include' dir and the 'vorbis/include' dir, and maybe others. I can't remember off the top of my head.