Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: alle_meije on June 13, 2012, 11:27:09 am
-
Hi
My project uses the fftw library for fast fourier transforms. I compile it in a separate project, with Debug and Release builds, and link the Debug build of fftw to the Debug build of my project and the Release build of fftw to the Release build of my project.
All works fin when I to have it set like this:
(1)
Build Options
main -
Debug - Linker settings - Link libraries: ../fftw/Bin/Debug/libfftw.so
Release - Linker settings - Link libraries: ../fftw/Bin/Release/libfftw.so
It seems more elegant though to do it like this:
(2)
Build Options
main - Linker settings - Link libraries: libfftw.so
Debug - Search directories - Linker: ../fftw/Bin/Debug
Release - Search directories - Linker: ../fftw/Bin/Release
Building it with method (2) fails though, with the familiar error
/usr/bin/ld: cannot find -lfftw.so
collect2: ld returned 1 exit status
So does method (2) just not work? Do linker search directories work differently from compiler search directories?
best wishes
Alle Meije
-
You should add "fftw" to your linker settings - link libraries, but NOT "libfftw.so"
-
That works! Thanks very much, I wouldn't have found that myself.
So in short
* when you supply the full path in 'Link libraries', you put fullpath/libNAME.so
* when you supply the path in 'Search directories', you put NAME in 'Link libraries'
This helps a lot! Only running from the main project dir (or else getting errors like /bin/Release/libbfftw.so: cannot open shared object file) was getting a bit cumbersome...
-
Thanks very much, I wouldn't have found that myself.
That's why I always suggest before using any IDE, compile at the command line to understand the compiler/linker interface. Than setting up your project in an IDE is a snap.
Its like running a garage w/o having ever driven a car otherwise.