I am trying to use MinGW to compile Linux project into Windows. I have been successful doing so with Cygwin, but I would match rather prefer to use MinGW so I the program does not end up having dozens of unnecessary dependencies.
Unfortunately, I have run into a problem that the compiler complains of unidentified references to the file. I am using a precompiled version of FFTW3 for Windows and using dlltool to create .a files to link it to MinGW. I have specified the libpath for the compiler, but unfortunately, I am still encountering errors.
Here is my output:
make all gcc -I../Include -L..\Lib -Wall -O3 -o lvdoenc lvdoenc.o lvdomain.o -I../Include -L..\Lib -m32 lvdoenc.o:lvdoenc.c:(.text+0x29b): undefined reference to _imp__fftw_execute' lvdoenc.o:lvdoenc.c:(.text+0x608): undefined reference to_imp__fftw_malloc' lvdoenc.o:lvdoenc.c:(.text+0x647): undefined reference to _imp__fftw_plan_r2r_2d' lvdoenc.o:lvdoenc.c:(.text+0x8d1): undefined reference to_imp__fftw_free' lvdoenc.o:lvdoenc.c:(.text+0x8e5): undefined reference to _imp__fftw_destroy_plan' c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: lvdoenc.o: bad reloc address 0x20 in section.eh_frame' c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: final link failed: Invalid operation collect2.exe: error: ld returned 1 exit status make: *** [lvdoenc] Error 1 13:23:28 Build Finished (took 217ms)
All the solutions I have come across involve compiling using gcc to link fftw3 (-lfftw3), but this does not work in MinGW. I am having the same problem in the Cygwin, but that solution of using -lfftw3 as a compiler option does work. I have even specified the location of the lib path. The include path works just fine, but it can't find the library in the libpath.
Any help would be great appreciated.
-lfftw3must be given, without it the linker can't resolve the symbols from this library. You should add what's not working when you compile with-lfftw3. I just downloaded the dlls, useddlltooland tried to link a symbol of the fftw3-library with MinGW and it worked...**\**Lib). Also you're passing the include and lib paths twice.dlltool -d libfftw3-3.def -l libfftw3.aint main() { fftw_malloc(); }gcc x.c -L.\. -lfftw3