I'm trying to do a simple FFT with the kiss_fft library, but I keep getting a linkage error and was hoping somebody could shed light on the situation. Here's my code (which I hope is correct as far as the usage of kiss_fft goes):
#include<stdlib.h>
#include<stdio.h>
#include "kiss_fft.h"
#define SIZE 1024
int main () {
double samples[SIZE];
int i;
for (i = 0; i < SIZE; i++) { // initialize samples to randomish values
samples[i] = (float)(rand() % 50) * .5;
}
kiss_fft_cfg cfg = kiss_fft_alloc(SIZE, 0, 0, 0);
kiss_fft_cpx fft_in[SIZE];
kiss_fft_cpx fft_out[SIZE];
for (i = 0; i < SIZE; i++) {
fft_in[i].r = samples[i];
fft_in[i].i = 0;
fft_out[i].r = 0;
fft_out[i].i = 0;
}
kiss_fft(cfg,fft_in,fft_out);
free(cfg);
}
And here's the error that I'm getting:
Undefined symbols for architecture x86_64:
"_kiss_fft", referenced from:
_main in FFT_standalone-712deb.o
"_kiss_fft_alloc", referenced from:
_main in FFT_standalone-712deb.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
According to kissFFT's readme document, the only thing I have to include is the kiss_fft header and I should be okay. Other than that, the program itself is not involved at all, and I'm not sure what could be the problem. C is also not my preferred language, so I could be doing something very wrong. Any ideas?