Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Using FlyCapture SDK with Qt Creator



  • I am usign Windows 7, Qt Creator 4.4.1 (x32) and FlyCapture SDK 2.11.3.425. The problem is that I keep getting linking errors when trying to use the FlyCapture Library.

    I have boiled down the problem to a simple program. The SDK main path is C:/PointGrey

    main.cpp

    #include <FlyCapture2.h>
    using namespace FlyCapture2;
    int main()
    {
        Camera camera;
        return 0;
    }
    

    FlyCaptureApp.pro

    SOURCES += main.cpp
    
    INCLUDEPATH += C:\PointGrey\include
    
    LIBS += -L$$PWD/../../../../../PointGrey/lib/ -lFlyCapture2
    LIBS += C:/PointGrey/bin/FlyCapture2GUI_C_v110.dll
    

    These are the errors:

    C:\Users\Gabriel\Desktop\Qt Basic\FlyCaptureApp\main.cpp:8: error: undefined reference to `_imp___ZN11FlyCapture26CameraC1Ev'
    C:\Users\Gabriel\Desktop\Qt Basic\FlyCaptureApp\main.cpp:8: error: undefined reference to `_imp___ZN11FlyCapture26CameraD1Ev'
    C:\Users\Gabriel\Desktop\Qt Basic\FlyCaptureApp\main.cpp:8: error: undefined reference to `_imp___ZN11FlyCapture26CameraD1Ev'
    collect2.exe:-1: error: error: ld returned 1 exit status
    

    So, how can I use FlyCapture SDK with Qt creator? Am I missing some .dll? Is FlyCapture only compatible with Visual Studio?


  • Lifetime Qt Champion

    Hi @gMatos,

    First question: Which compiler was used to compile the FlyCapture library? It has to match your compiler, i.e. you cannot mix MinGW and Visual C++.

    LIBS += -L$$PWD/../../../../../PointGrey/lib/ -lFlyCapture2
    
    That line looks good, but please check the path! If the number of `..` is incorrect, the linker will not find the library.
    
    Note that it may be necessary to link against more libraries, not only FlyCapture2.
    
    > ```
    > C:\Users\Gabriel\Desktop\Qt Basic\FlyCaptureApp\main.cpp:8: error: undefined reference to `_imp___ZN11FlyCapture26CameraC1Ev'
    
    Further note: Avoid directories and file names with spaces. That may lead to hard-to-track errors.
    
    > Am I missing some .dll? 
    
    At the link stage, no. At this stage the .lib or .a files are needed. The dll is needed at runtime.
    
    > Is FlyCapture only compatible with Visual Studio?
    As said above, if FlyCapture was compiled with Visual C++, then yes.


  • @aha_1980, thank you for your answer!

    This was indeed the problem. The library was compiled with Visual C++.
    I changed the compiler in Qt Creator and the problem was solved!


Log in to reply