Results 1 to 5 of 5

Thread: Linking DLL to Project

  1. #1
    Join Date
    Nov 2010
    Posts
    23
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Linking DLL to Project

    Hey everyone,

    I'm trying to link the FFTW libraries to my project in Windows. It works great when I do my development on my Macbook but I'm having difficulty getting the DLLs to link in on windows (I haven't really done it before)

    I have placed the libfftw3-3.dll and fftw3.h file in my C:/Windows/System32/ directory. The error now I get is "undefined reference to '_imp_fftw_malloc', etc., indicating that the linking was incorrect.

    Sorry, I know I'm a newbie at this. Any suggestions?

    Here is my .pro file:
    Qt Code:
    1. HEADERS += \
    2. mainwindow.h \
    3. corrsettingsdialog.h \
    4. fileopendialog.h \
    5. vardefs.h \
    6. qpiv.h \
    7. vectorscalingdialog.h \
    8. batchsettings.h
    9.  
    10. SOURCES += \
    11. mainwindow.cpp \
    12. main.cpp \
    13. corrsettingsdialog.cpp \
    14. corr_dcc.cpp \
    15. fileopendialog.cpp \
    16. subpixel_est.cpp \
    17. outlier_det.cpp \
    18. interp_vec.cpp \
    19. temp.cpp \
    20. run_corr.cpp \
    21. grid_gen.cpp \
    22. file_func.cpp \
    23. vectorscalingdialog.cpp \
    24. corr_dncc.cpp \
    25. batchsettings.cpp \
    26. corr_fft.cpp
    27.  
    28. FORMS += \
    29. corrsettingsdialog.ui \
    30. fileopendialog.ui \
    31. vectorscalingdialog.ui \
    32. batchsettings.ui
    33.  
    34. win32 {
    35. LIBS += -LC:/Windows/System32/libfftw3-3
    36. INCLUDEPATH += C:/Windows/System32/
    37. }
    38.  
    39. macx {
    40. LIBS += -lfftw3 -lm
    41. INCLUDEPATH += /usr/local/include
    42. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by lynchkp; 13th December 2010 at 20:35.

  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: Linking DLL to Project

    This post steps through doing the setup for a different library but they apply equally here.

    Only the DLL should put into the Windows System32 directory: it is the only runtime requirement.
    The header file needs to be found in the path you add to INCLUDEPATH
    The link libraries need to be found in the path you add to LIBS with -L, and identified with the -l option (libfftw3.a or libfftw3.lib depending on compiler).
    We don't know how you have 'installed' the library on Windows so we cannot give you exact paths. This is what the installation looks like on UNIX:
    Qt Code:
    1. /tmp/fftw
    2. /tmp/fftw/lib
    3. /tmp/fftw/lib/libfftw3.so.3.2.4
    4. /tmp/fftw/lib/libfftw3.a // link time library, may be .lib for MSVC
    5. /tmp/fftw/lib/libfftw3.la
    6. /tmp/fftw/lib/pkgconfig
    7. /tmp/fftw/lib/pkgconfig/fftw3.pc
    8. /tmp/fftw/lib/libfftw3.so // run time dynamic library, the DLL on Windows
    9. /tmp/fftw/lib/libfftw3.so.3
    10. /tmp/fftw/share
    11. /tmp/fftw/share/info
    12. /tmp/fftw/share/info/fftw3.info
    13. /tmp/fftw/share/info/dir
    14. /tmp/fftw/share/man
    15. /tmp/fftw/share/man/man1
    16. /tmp/fftw/share/man/man1/fftw-wisdom.1
    17. /tmp/fftw/share/man/man1/fftw-wisdom-to-conf.1
    18. /tmp/fftw/bin
    19. /tmp/fftw/bin/fftw-wisdom
    20. /tmp/fftw/bin/fftw-wisdom-to-conf
    21. /tmp/fftw/include
    22. /tmp/fftw/include/fftw3.h // compile time include
    23. /tmp/fftw/include/fftw3.f
    To copy to clipboard, switch view to plain text mode 
    for which you would set
    Qt Code:
    1. INCLUDEPATH += /tmp/fftw/include
    2. LIBS += -L/tmp/fftw/lib -lfftw3
    To copy to clipboard, switch view to plain text mode 

  3. #3

    Default Re: Linking DLL to Project

    Hello,
    Could you have more details about compiling fftw and linking it to my .pro?
    I tried to add fftw to my .pro
    LIBS += -libfftw3-3\

    -libfftw3f-3\

    -libfftw3l-3\

    "C:/OpenCV-2.3.1MinGW/lib/libopencv_core231.dll.a" \

    "C:/OpenCV-2.3.1MinGW/lib/libopencv_highgui231.dll.a" \

    "C:/OpenCV-2.3.1MinGW/lib/libopencv_imgproc231.dll.a" \

    "C:/QtSDK/mingw/lib/libgdi32.a"


    and i hace the following error


    mingw32-make.exe: *** [debug] Error 2

    14:44:23: Le processus "C:\QtSDK\mingw\bin\mingw32-make.exe" s'est terminé avec le code 2.
    Thanks
    Best regards,
    Maroua

  4. #4
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Linking DLL to Project

    Are You sure that this is correct name of library file : libopencv_core231.dll.a ?
    Do not be libopencv_core231.dll or libopencv_core231.a ?
    I'm not using mingw on Windows but for me it is strange.

  5. #5
    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: Linking DLL to Project

    Quote Originally Posted by maroua_ View Post
    Hello,
    Could you have more details about compiling fftw and linking it to my .pro?
    I tried to add fftw to my .pro
    Qt Code:
    1. LIBS += -libfftw3-3\
    2. // blank line?
    3. -libfftw3f-3\
    4. // blank line?
    5. -libfftw3l-3\
    6. // blank line?
    7. "C:/OpenCV-2.3.1MinGW/lib/libopencv_core231.dll.a" \
    8. // blank line?
    9. "C:/OpenCV-2.3.1MinGW/lib/libopencv_highgui231.dll.a" \
    10. // blank line?
    11. "C:/OpenCV-2.3.1MinGW/lib/libopencv_imgproc231.dll.a" \
    12. // blank line?
    13. "C:/QtSDK/mingw/lib/libgdi32.a"
    To copy to clipboard, switch view to plain text mode 
    If the name of the library file is libfftw3f-3.so (for example) then the LIBS entry should look like this:
    Qt Code:
    1. LIBS += -lfftw3f-3
    To copy to clipboard, switch view to plain text mode 
    that is, a -l option followed by "fftw3f-3" as the argument.

    If the blank lines in your LIBS entry (marked above) are actually present in your PRO file then remove them.

Similar Threads

  1. Linking With Qt VS Add in
    By rcjohns in forum Newbie
    Replies: 2
    Last Post: 14th March 2010, 12:42
  2. Replies: 1
    Last Post: 3rd December 2009, 23:34
  3. Linking
    By ^NyAw^ in forum General Programming
    Replies: 7
    Last Post: 30th October 2008, 17:37
  4. Error Linking QWT-project
    By effendi in forum Qwt
    Replies: 1
    Last Post: 28th October 2008, 06:54
  5. Project generation on linux from QT Project
    By darpan in forum Qt Programming
    Replies: 6
    Last Post: 11th December 2006, 09:43

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.