Results 1 to 5 of 5

Thread: Undefined reference to fftwf

  1. #1
    Join Date
    Mar 2016
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Undefined reference to fftwf

    Hello I am new here and I have a problem with compiling my code, I get the following error:

    /home/maxfkira/Demo/lib/libdemo.a(TracHold.o): In function `exitTrac':
    TracHold.c: (.text+0x1b): undefined reference to `fftwf_malloc'
    TracHold.c: (.text+0x37): undefined reference to `fftwf_malloc'
    TracHold.c: (.text+0x53): undefined reference to `fftwf_free'
    TracHold.c: (.text+0x6f): undefined reference to `fftwf_free'

    I am using a .pro file and I have installed fftw-3.2.1. The linker's library search path is /usr/lib/x86_64-linux-gnu and the files are also present there.

    TEMPLATE = app
    TARGET = TRACconsole
    DESTDIR = ../bin
    QT += core \
    gui
    SOURCES += main.cpp
    LIBS += -L/home/maxfkira/Demo/lib -ldemo
    POST_TARGETDEPS += ../lib/libdemo.a
    MOC_DIR = ./build
    OBJECTS_DIR = ./build
    INCLUDEPATH += /usr/lib/x86_64-linux-gnu
    LIBS += -L/usr/lib/x86_64-linux-gnu -lfftw3 -lfftw3f -lm

    I am unable to identify where the problem is. I would be really grateful for some help.
    Thank you.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Undefined reference to fftwf

    Try moving the last LIBS line before the first. This will lilely cause the linker command to list/scan the fft library before the demo library.

  3. #3
    Join Date
    Mar 2016
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Undefined reference to fftwf

    I have made a .pri file named common.pri which has the following code from above:

    MOC_DIR = ./build
    OBJECTS_DIR = ./build
    INCLUDEPATH += usr/lib/x86_64-linux-gnu/
    LIBS += -L/usr/lib/x86_64-linux-gnu/ -lfftw3f -lm

    and linked it to my other .pro files as include(../common.pri). So, I suppose the linker would scan the fft library before any LIBS in any of my .pro file but still the same error exists.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Undefined reference to fftwf

    According to http://www.fftw.org/fftw3_doc/Data-T...ypes-and-Files the libs for FFTW should be listed at the end... The problem lies elsewhere.

    Have you built your app and lib demo with a 64-bit compiler?
    Can you compile and link an FFTW example outside of Qt tools?

  5. #5
    Join Date
    Mar 2016
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Unhappy Re: Undefined reference to fftwf

    yes, I have built it with a 64-bit compiler and FFTW works outside of QT tools for another code but still doesn't work in my case.

    I have tried removing all FFTW files and used libfftw3-dev, still no effect.

    I am using Virtualbox for ubuntu 15.10. I have tried working my code in windows using Qt Creator & precompiled FFTW 3.3.4 Windows DLLs(libfftw3f-3.dll) downloaded from http://www.fftw.org/install/windows.html and it works by linking -lfftw3f-3, now is there any similar file that would work on ubuntu?

Similar Threads

  1. undefined reference
    By deepakswaroop in forum Newbie
    Replies: 1
    Last Post: 2nd March 2011, 07:46
  2. Undefined reference
    By eekhoorn12 in forum Qt Programming
    Replies: 2
    Last Post: 6th January 2011, 16:45
  3. undefined reference
    By digidas in forum Newbie
    Replies: 9
    Last Post: 19th May 2010, 14:04
  4. undefined reference
    By jayreddy in forum Qt Programming
    Replies: 1
    Last Post: 20th November 2009, 14:45
  5. Undefined reference to crt
    By derektaprell in forum Installation and Deployment
    Replies: 0
    Last Post: 20th October 2009, 09:34

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.