trying to get fftw to work.
I'm on an M2 macbook, used brew to install fftw. Within my IDE, #include <fftw3.h> doesn't throw an error, and autocomplete correctly lists fftw constants and functions, so it seems like it installed somewhat correctly?
But trying to compile this tiny program:
#include <stdio.h> #include <fftw3.h> int main(void) { fftw_complex* P = fftw_malloc(1); printf("Hello world\n"); } Leads to: ld: library 'fftw3' not found.
That was with clang FFT.c -L/usr/local/include -lfftw3 -o FFT
Also tried clang FFT.c -I/usr/local/include -L/usr/local/include -lfftw3 -o FFT
And clang FFT.c -lfftw3 -o FFT
And clang FFT.c -o FFT where expectedly it says symbol not found
I tried brew installing gcc-14 aswell, but it doesn't work at all, stating:
In file included from /opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/gcc/aarch64-apple-darwin24/14/include-fixed/stdio.h:75, from FFT.c:1: /opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/gcc/aarch64-apple-darwin24/14/include-fixed/_stdio.h:78:10: fatal error: sys/cdefs.h: No such file or directory 78 | #include <sys/cdefs.h> | ^~~~~~~~~~~~~ compilation terminated. Running locate fftw3.h returns 3 locations:
/opt/homebrew/Cellar/fftw/3.3.10_2/include/fftw3.h /opt/homebrew/include/fftw3.h /usr/local/include/fftw3.h But none of the directories here work when I put them in as -L.
Not sure what else to do here :( fftw3.h is definitely where I tell the compiler it is!
ldtelling you there is a problem. It is notclangtelling you there is a problem.ldis the linker.