Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I have a very simple question regarding the use of external library in Qt, and in particular FFTW. I am working on a project in whice I need to build a GUI. I am working with Qt creator for the first time and am a pretty novice porgrammer.

I need to preform fft in my program and I have found that FFTW library is very useful for that matter. How I can make use of the library in Qt? I know It porbably have nothing to do with the program and more with the C++ language and compiling and linking, but I am basicly in the dark on this subject.

I failed to find a detailed enough answer and can make progress on my project without the use of this library. please help.

Yes I have encountered this question but non of the answers have helped me! that is why I asked again in order to wishfully get a detailed enough answer! Daniels Jul 23, 2015 at 0:03

When you want to use an external library in c/c++ first of all you will have to find one ore more *.h files that should have been shipped with the library, .h files describe to the compiler what will be found inside the library. You will have to #include the correct .h file in your code and tell the compiler where to find it (in which folder).

in your case you should have a line at the top of your program

#include <fftw3.h>

Adding this linr in you .pro file will help the compiler finding where your .h file is.

INCLUDEPATH += "C:/fftwMinGW"

Then you will have to specify to the compiler where the library can be found and what's its name. You do that by adding a line into you .pro file (the project file) that you find at the top of thr tree of your project on the left side in Qt creator.

The line to add to the pro file is the following. LIBS''= -lfftw3

Thank you for your response. I did include fftw3.h at the top. As you suggested I added to the .pro file the commands: INCLUDEPATH += "C:/fftwMinGW" (with the path in which the library is.) and LIBS''= -lfftw3. Sadly when I run my code I get an error: "cannot find -lfftw3". What should I do ? – Daniels Jul 21, 2015 at 22:46 You would also need to add a switch to LIBS to tell it where to find the fftw3 library for linking. Something like LIBS = -LC:/fffwMingW -lfftw3 – Hamish Moffatt Jul 22, 2015 at 1:16 Here is my current .pro file : i.imgur.com/u7iXMu2.png I still get the same error. What am I doing wrong? thank you for your help. – Daniels Jul 22, 2015 at 10:40 in C:\User\Desktop\... you actually have a file called fftw3.a ? maybe you a \lib folder in there – Marco Jul 22, 2015 at 13:21 In that folder I have all the files in the download found here: fftw.org/install/windows.html (32-bit version). I don't see there any file called fftw3.a .. – Daniels Jul 22, 2015 at 13:29