Results 1 to 7 of 7

Thread: Can't make NCReport work on Windows

  1. #1
    Join Date
    Nov 2009
    Location
    Argentina
    Posts
    16
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Can't make NCReport work on Windows

    Hi everybody,
    I'm having problems when trying to run an application with NCReports.
    Here is the thing: I have installed Qt 4.5.2, with Qt Creator 1.2.1, and I had downloaded the NCReports from here http://www.nocisoft.com/?id=down&lang=en (NCReport_2.4.1_Win32_MinGW.exe). I installed it and everything was working perfect. I tried some examples, that showed how to make NCReports run from a Qt application, and they worked too.

    But when I try to include it in my application, I get "application exited with code -1073741515".

    This is my .pro file:
    Qt Code:
    1. DEFINES += NCREPORT_IMPORT
    2. LIBS += "C:\Archivos de programa\NCReport\2.4.1.mingw\lib\ncreport2.dll"
    3. INCLUDEPATH += "C:\Archivos de programa\NCReport\2.4.1.mingw\include"
    4. QT += xml sql
    5. TEMPLATE = app
    6. DEFINES += QT_NO_DEBUG_OUTPUT
    7.  
    8. CONFIG += warn_on \
    9. qt \
    10. thread \
    11. release
    12.  
    13. # Input
    14. HEADERS += ......
    15. SOURCES += ......
    16. RESOURCES += resources.qrc
    To copy to clipboard, switch view to plain text mode 

    And in the class that creates the report, I include these headers:
    Qt Code:
    1. #include "ncreport.h"
    2. #include "ncreportoutput.h"
    3. #include "ncreportpreviewoutput.h"
    4. #include "info.h"
    5. #include "ncreportpreviewwindow.h"
    6. #include "utils.h"
    To copy to clipboard, switch view to plain text mode 

    Then, I compile and everything works great. After that, I add the line
    Qt Code:
    1. NCReport *report = new NCReport;
    To copy to clipboard, switch view to plain text mode 

    Then, I compile again and get "application exited with code -1073741515".
    I don't know what I am missing, the example projects work, and I think that there are no difference between those projects and mine.
    Please, If someone can help me, I'll be really thanked.
    Best regards,
    Facundo
    Last edited by pucara_faa; 26th January 2010 at 18:45.

  2. #2
    Join Date
    May 2009
    Location
    Gorontalo
    Posts
    200
    Thanks
    20
    Thanked 5 Times in 5 Posts
    Qt products
    Platforms
    Unix/X11 Windows

    Cool Re: Can't make NCReport work on Windows

    I get the same problem. Have tried several different versions, but always get problem (on Windows)

  3. #3
    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: Can't make NCReport work on Windows

    I don't know how with Mingw version but MS Visual version have only release binaries. After linking this with our code compiled in debug mode we observe strange behaviours. After compiling our code in release mode all was working.

  4. #4
    Join Date
    Nov 2009
    Location
    Argentina
    Posts
    16
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Can't make NCReport work on Windows

    Quote Originally Posted by Lesiok View Post
    I don't know how with Mingw version but MS Visual version have only release binaries. After linking this with our code compiled in debug mode we observe strange behaviours. After compiling our code in release mode all was working.
    Yes, I'm using the MinGW version, and I'm compiling in release mode. Still getting the same error.
    Thanks for your reply.

  5. #5
    Join Date
    Nov 2009
    Location
    Argentina
    Posts
    16
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: Can't make NCReport work on Windows

    Problem solved
    I solved the "problem" (althought it wasn't a problem) after several hours, and it was very simple.
    As I didn't get a solution from the forum, I decided to contact to NCReport support (from http://www.nocisoft.com). I wrote an email telling them what was my problem and blah blah.
    I wasn't expecting an answer, but 10 minutes later, I get an email with the answer from the support telling me some things to try.
    I answered them with some other stuff and some hours later, I realized that the solution was to put some libraries into the directory where the .exe is (it was THAT SIMPLE).

    For all those who had the same problem, I hope to help them:
    In your pro file, put the following:
    Qt Code:
    1. DEFINES += NCREPORT_IMPORT
    2. LIBS += bin\ncreport2.dll
    3. INCLUDEPATH += "REPLACE HERE THE PATH TO NCREPORT ROOT FOLDER\include"
    4. QT += xml sql
    5. TEMPLATE = app
    6. DEFINES += QT_NO_DEBUG_OUTPUT
    7.  
    8. CONFIG += warn_on \
    9. qt \
    10. thread \
    11. release
    To copy to clipboard, switch view to plain text mode 

    Then, in the file where you are going to use the report:

    Qt Code:
    1. #include "ncreport.h"
    2. #include "ncreportoutput.h"
    3. #include "ncreportpreviewoutput.h"
    4. #include "info.h"
    5. #include "ncreportpreviewwindow.h"
    6. #include "utils.h"
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. NCReport *report = new NCReport();
    2. report->reset();
    3. report->clearBatch();
    4. report->setReportFile("PATH TO THE REPORT");
    5. report->addItemModel(im, "model1");
    6. report->runReportToPreview();
    7. if (!report->hasError()){
    8. NCReportPreviewWindow *pv = new NCReportPreviewWindow();
    9. pv->setOutput( (NCReportPreviewOutput*)report->output() );
    10. pv->setWindowModality( Qt::ApplicationModal );
    11. pv->setAttribute( Qt::WA_DeleteOnClose );
    12. pv->show();
    13. }
    To copy to clipboard, switch view to plain text mode 

    And you have to copy the libraries that are in (NCREPORT FOLDER)/bin to the folder where your application is. Some libraries are optional.
    I hope to help someone, it's a very simple task, but the documentation didn't say that (or I missed it).
    Best regards,
    Facundo.

  6. #6
    Join Date
    Mar 2010
    Location
    Valencia, Venezuela
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Can't make NCReport work on Windows

    Hi, I had the same problem, so I did everything you mentioned, but now I get this message:

    "The procedure entry point _Z9qBadAlloc could not be located in the dynamic build library QtCored4.dll"

    I have the ncreport2.dll and libgcc_s_dw2-1.dll in my .exe folder... Am I missing something?

    Any help would be greatly appreciated.

  7. #7
    Join Date
    Dec 2010
    Posts
    20
    Thanks
    9
    Thanked 3 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Can't make NCReport work on Windows

    Quote Originally Posted by orianabanana View Post
    Hi, I had the same problem, so I did everything you mentioned, but now I get this message:

    "The procedure entry point _Z9qBadAlloc could not be located in the dynamic build library QtCored4.dll"

    I have the ncreport2.dll and libgcc_s_dw2-1.dll in my .exe folder... Am I missing something?

    Any help would be greatly appreciated.
    You copied the wrong QtCored4.dll, try to find another one which has bigger size.
    hope it works

Similar Threads

  1. How to run NCreport in Ubuntu
    By zikril in forum Newbie
    Replies: 0
    Last Post: 21st October 2009, 09:08
  2. [solved] Little problem with NCReport, New page ?!
    By QAmazigh in forum Qt Programming
    Replies: 3
    Last Post: 10th June 2009, 10:58
  3. Problem with NCReport : can't link shared library !
    By QAmazigh in forum Qt Programming
    Replies: 4
    Last Post: 6th June 2009, 00:38
  4. Qt and NCReport
    By alphajoseph in forum Qt Programming
    Replies: 1
    Last Post: 20th February 2009, 11:29
  5. Installing NCReport
    By alphajoseph in forum Qt Programming
    Replies: 2
    Last Post: 19th February 2009, 11:30

Tags for this Thread

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.