[SOLVED] Error in NCReport for Qt 5.1.1 minGW



  • after a long wait NCreport release a compatible version for Qt 5.1.1 minGW

    every thing work perfectyl but after implementation my programme can't start

    her is my code .pro file
    @
    #-------------------------------------------------

    Project created by QtCreator 2013-09-17T18:17:24

    #-------------------------------------------------

    QT += core gui sql xml printsupport

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = testncreport
    TEMPLATE = app

    INCLUDEPATH += "E:\apprendreQt\gestionstock6\includes\include"

    SOURCES += main.cpp
    mainwindow.cpp

    HEADERS += mainwindow.h

    FORMS += mainwindow.ui

    LIBS += "-LE:\apprendreQt\gestionstock6\includes\lib -lNCReport2"
    @

    her is the mainwindow.cpp

    @
    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include "ncreport.h"
    #include "ncreportpreviewoutput.h"
    #include "ncreportoutput.h"
    #include "ncreportpreviewwindow.h"

    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);

    NCReport *report = new NCReport(this);
    report->reset(true);
    report->setReportFile("E:\apprendreQt\gestionstock6\includes\reports\test.xml");
    report->runReportToPrinter();
    

    }

    MainWindow::~MainWindow()
    {
    delete ui;
    }@

    after compiling i get this error

    @C:\test\testncreport\mainwindow.cpp:14: error: undefined reference to _imp___ZN8NCReportC1EP7QObject' C:\test\testncreport\mainwindow.cpp:15: error: undefined reference to_imp___ZN8NCReport5resetEb'
    C:\test\testncreport\mainwindow.cpp:15: error: undefined reference to _imp___ZN8NCReport5resetEb' C:\test\testncreport\mainwindow.cpp:17: error: undefined reference to_imp___ZN8NCReport18runReportToPrinterEibP7QWidgetRK7QString'
    collect2.exe:-1: error: error: ld returned 1 exit status

    @


  • Lifetime Qt Champion

    Hi,

    Where is your NCReport2 stuff located ?



  • my NCreport2 is located in

    E:\apprendreQt\gestionstock6\includes\lib

    this is the full path

    E:\apprendreQt\gestionstock6\includes\lib\libNCReport2.a



  • Remove the quotes in your LIBS variable. At the moment you are specifying a single (broken) -L option.



  • ok, removing quotes i get another error

    @Starting C:\test\build-testncreport-Qt_5_1_1_MinGW_32_bit_MinGW_4_8_32bit-Debug\debug\testncreport.exe...
    QObject: Cannot create children for a parent that is in a different thread.
    (Parent is MainWindow(0x22fe1c), parent's thread is QThread(0x128ee210), current thread is QThread(0x12927130)
    QPrinter: Must construct a QApplication before a QPaintDevice
    Invalid parameter passed to C runtime function.
    Invalid parameter passed to C runtime function.
    C:\test\build-testncreport-Qt_5_1_1_MinGW_32_bit_MinGW_4_8_32bit-Debug\debug\testncreport.exe exited with code 3@


  • Lifetime Qt Champion

    What does your main.cpp look like ?



  • her is the code of main.cpp @#include "mainwindow.h"
    #include <QApplication>

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    return a.exec&#40;&#41;;
    

    }
    @


  • Lifetime Qt Champion

    What happens if you don't pass the parent to when creating a NCReport ?



  • i'm no longer getting the ealier error ,

    now i get this error

    @Starting C:\test\build-testncreport-Desktop_Qt_5_1_1_MinGW_32bit-Debug\debug\testncreport.exe...
    The program has unexpectedly finished.
    C:\test\build-testncreport-Desktop_Qt_5_1_1_MinGW_32bit-Debug\debug\testncreport.exe exited with code -1073741515@


  • Lifetime Qt Champion

    You need to run your application with a debugger to see where the error is triggered



  • i get this error
    @
    During startup program exited with code 0xc0000135.@


  • Lifetime Qt Champion

    This is a library not found error, do you have the NCReport dll somewhere in your PATH ?

    If not, got to the Run panel and update the PATH environment variable adding the path to the folder where that dll can be found.



  • i have placed them before but i get the same error

    i have deleted the debug folder , then recompile and replace the dll files

    no it's working for me , but NCreport windows not appears yet only the main windows



  • is this code right ?

    @void MainWindow::on_pushButton_clicked()
    {
    NCReport *report = new NCReport(this);
    report->reset(true);
    report->setReportFile("E:\apprendreQt\gestionstock6\includes\reports\test.xml");
    report->runReportToPrinter();
    }
    @


  • Lifetime Qt Champion

    No, you don't escape the backslashes in your path. You either have to to that or since your using Qt, use forward slashes.



  • Ok, it works


Log in to reply
 

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