0

The Question & Background I'm a novice programmer with a few years of off and on experience with programing in General. I'm no expert but I am still a little bit off being a noob. What I have been trying to do is play MP3 files with the following code.

void loadMp3File(const char* filename)
{
    mpg123_handle *mh;
    unsigned char *buffer;
    size_t buffer_size;
    size_t done;
    int err;

    int channels, encoding;
    long rate;

    mpg123_init();
    mh = mpg123_new(NULL, &err);
    buffer_size = mpg123_outblock(mh);
    buffer = (unsigned char*) malloc(buffer_size * sizeof(unsigned char));

    mpg123_open(mh, filename);
    mpg123_getformat(mh, &rate, &channels, &encoding);

    int m_bits = mpg123_encsize(encoding);
    int m_rate = rate;
    int m_channels = channels;


    /* decode and play */
    for (int totalBtyes = 0 ; mpg123_read(mh, buffer, buffer_size, &done) == MPG123_OK ; ) {
        totalBtyes += done;
    }


    /* clean up */
    free(buffer);
    mpg123_close(mh);
    mpg123_delete(mh);
    mpg123_exit();

}

What I have done thus far I've spend a few days messing around, with the Visual Studio files included with the source for mpg123. I changed and messed around with the additional dependices in the settings, with much trial and error I was able to produce a library file. Put simply it produced a mile of linker errors despite my attempts to fix it.

Conclusion My question is how do I fix this problem or should I make other considerations? Either way thank you in advance to anyone who takes the time to answer this question.

Some errors if needed

libmpg123.lib(index.obj) : error LNK2001: unresolved external symbol _INT123_saf
e_realloc
libmpg123.lib(optimize.obj) : error LNK2001: unresolved external symbol _INT123_
dct36_sse
libmpg123.lib(icy2utf8.obj) : error LNK2001: unresolved external symbol _INT123_
compat_strdup
main.exe : fatal error LNK1120: 3 unresolved externals

Just wanted to add that this question is entirely unrelated to one that marked this as a duplicate. It doesn't provide a clear or remotely meaningful description of the problem.

Fil Nick
  • 75
  • 1
  • 1
  • 5
  • 1
    Show some of your errors please. – Richard Critten Oct 24 '16 at 15:40
  • We don't know the problem unless you post the errors. – drescherjm Oct 24 '16 at 15:53
  • libmpg123.lib(index.obj) : error LNK2001: unresolved external symbol _INT123_saf e_realloc libmpg123.lib(optimize.obj) : error LNK2001: unresolved external symbol _INT123_ dct36_sse libmpg123.lib(icy2utf8.obj) : error LNK2001: unresolved external symbol _INT123_ compat_strdup main.exe : fatal error LNK1120: 3 unresolved externals – Fil Nick Oct 24 '16 at 15:59

0 Answers0