views:

1197

answers:

2

I build an application in Borland C++ 6 and I'd like to import external, non Borland library (FFTW, to be exact, http://www.fftw.org). I have downloaded the fftw dll file, used the implib.exe program to build a lib file known to Borland, included fftw.h in source and copied fftw.h to Borland/include, fftw.lib to Borland/lib and .h, .dll and .lib files to my project folder. Unfortunately i get several linker errors, which claims: "Unresolved external '{name of the FFTW function}' referenced from {name of the source file}" What do i do wrong?

A: 

Are you sure that Borland is doing proper name-mangling of the external functions, and that the header has been surrounded with extern "c" {}? And are you sure that Borland is indeed trying to link with the .lib file? Make sure the compiler has the verbose option set.

If that doesn't work, why don't you build FFTW from source instead of using a DLL?

Mark Rushakoff
What do you mean by extern "c"?
Extern "c" tells a linker to look for a function compiled in C, not in C++. Because you are using a C++ compiler, the linker might be looking for the wrong (mangled) function name. http://wiki.answers.com/Q/What_is_the_use_of_extern_in_C
Mark Rushakoff
+1  A: 

I think you're only missing one step... add the .lib file that implib created to your project.

David Dean - Embarcadero