Jorge
Jorge

Reputation: 30

sndfile.h C CodeBlocks Windows 7

I'm working on CodeBlocks 12.11 on windows 7 (64 bit). I'm programming in C and i'm using the library: libsndfile (http://www.mega-nerd.com/libsndfile/api.html) to easily read a .wav and convert it to a double array.

I ran the wizard of libsndfile (for windows 64 bit), also in the compiler settings of Codeblocks, I added the search directories for the compiler and linker. But, when I compile the program the only error is an:

"undefined reference to sf_open_fd"

Here's the code:

#include <stdio.h>
#include <stdlib.h>  
#include <sndfile.h>

int main (int argc, char *argv[]) {

    FILE* wavf;
    SF_INFO info;
    char* name = "example.wav";
    wavf = fopen(name, "r");
    SNDFILE* source = sf_open_fd(fileno(wavf), SFM_READ, &info, 1);
    .
    .
    .
}

Any ideas? thank you!

Upvotes: 1

Views: 859

Answers (1)

akhil
akhil

Reputation: 732

  1. Check whether the library and the application are for same architecture(say x64).
  2. Check whether the library is linked to the app.
  3. Check whether the application and library are compiled using c compiler.

Upvotes: 1

Related Questions