Lime Report on 5.7?



  • I am trying to utilize a pdf reporting tool called lime report. The brief usage instructions are as follows

    #include "lrreportengine.h" to add report engine
     #include "lrcallbackdatasourceintf.h" if you want use callback datasources
    
     report = new LimeReport::ReportEngine(this); to create reportengine
     report->dataManager()->addModel("string_list",stringListModel,true); to add datasource to report engine
     report->loadFromFile("donors.lrxml");
     report->previewReport(); to generate report and preview
     //report->printReport(); to print report
    

    When I try to run this code I get the following errors

    undefined reference to 'LimeReport::ReportEngine::dataManager()'
    undefined reference to 'LimeReport::ReportEngine:loadFromFile(QString const&)'
    undefined reference to 'LimeReport::previewReport(QFlags<LimeReport::PreviewHint>)'
    

    Any idea what is going on here? is LimeReport perhaps incompatible with the newer Qt 5.7?
    Thanks!



  • looks like your are not linking the libraries to your project.
    Could you post your .pro file? (the LIBS part is what we are looking for)



  • @VRonin

    Hey, thanks for the reply. I did try linking the header file under SOURCES in the PRO file without success. So here is my current one

    QT       += core gui xml network sql printsupport quick positioning location
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    win32
    {
        LIBS += -LC:/OpenSSL-Win32/lib -lubsec
        INCLUDEPATH += C:/OpenSSL-Win32/include
    }
    
    TARGET = Alive_App
    TEMPLATE = app
    
    
    SOURCES += main.cpp\
            mainwindow.cpp \
            qcustomplot.cpp \
    
    
    
    
    HEADERS  += mainwindow.h \
        qcustomplot.h \
        map.h \
    
    
    FORMS    += mainwindow.ui
    
    DISTFILES += map.qml \
        ../../../../Deployment/Alive App/alivefull.png
    
    
    win32: RC_ICONS = /alive.ico
    

    Thankyou





  • Hi @Scottish_Jason,

    Looks like you need:

    LIBS += -llimereport
    

    See also, Re: undefined reference (limereport forum).

    Cheers.



  • @Paul-Colby

    Hi. Trying

    INCLUDEPATH += "C:/LimeReport/include"
     LIBS += -llimereport
    

    gives me "cannot find -llimereport"
    I'm not sure what the library file is. I can't find any .lib files in the folder structure.
    There's a file called LimeReport inside include but linking to that just causes it to crash out.

    Any ideas?



  • @Scottish_Jason said in Lime Report on 5.7?:

    gives me "cannot find -llimereport"
    I'm not sure what the library file is. I can't find any .lib files in the folder structure.

    Did you build LimeReport? or download some install package for your OS?

    As per the LimeReport downloads page:

    How to use it
    1 Build limereport.pro. It will create a limereport shared library
    2 In your project connect the limereport library ...

    The .lib (or .so) files should have been created in step 1 - ie when you built limereport.pro, so check for the .lib file in that project's output.

    Then, add:

    LIBS += -L<path-to-libreport.pro's-output-dir>
    

    The final result, in your *.pro file, might look something like:

    INCLUDEPATH += "C:/LimeReport/include"
    LIBS += -LC:/LimeReport/release -llimereport
    

    But it depends on the what the build output of the LimeReport project looks like.

    Cheers.



  • This post is deleted!


  • @Paul-Colby

    Hi Paul.

    After linking like so my app just crashes out while trying to compile. Any ideas?

      INCLUDEPATH += C:/LimeReport/build/5.7.0/win32/release/lib/include
        LIBS += -L C:/LimeReport/build/5.7.0/win32/release/lib -llimereport
    

    I also tried linking to a precompiled lib for windows. Again it just crashes
    also building limereport.pro does not appear to put a .lib file anywhere. It does create a limereport.dll though


  • Lifetime Qt Champion

    Hi,

    Where is your limerport.dll located ?

    Depending on that, you should modify the PATH environment variable in the Run part of the Project panel of Qt Creator and add at the path to the folder containing it.



  • @SGaist

    The limereport.dll file appears in "C:\LimeReport\build\5.7.0\win32\release\lib" after building limereport.pro which, is inside C:\LimeReport.
    No limereport.lib appears in this folder or any other folder after building.

    I have a precompiled version downloaded that contains limereport.dll, limereport.exp and limereport.lib.
    Linking to this also results in a crash.



  • @SGaist

    Adding the dll path to my PATH variable solved the issue. Thanks again SGaist! and Paul


  • Lifetime Qt Champion

    The path used to locate the .lib file that you link to and the .dll are two different things even if the files can be found in the same folders. That's why you need to help the system find the .dlls you are using either by copying said .dll in the folder where the application can be found, or modify the PATH environment variable. The first solution is used when deploying your application, the second should only be done locally in the IDE when you are developing.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.