PDA

View Full Version : Can't make NCReport work on Windows



pucara_faa
26th January 2010, 16:56
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:

DEFINES += NCREPORT_IMPORT
LIBS += "C:\Archivos de programa\NCReport\2.4.1.mingw\lib\ncreport2.dll"
INCLUDEPATH += "C:\Archivos de programa\NCReport\2.4.1.mingw\include"
QT += xml sql
TEMPLATE = app
DEFINES += QT_NO_DEBUG_OUTPUT

CONFIG += warn_on \
qt \
thread \
release

# Input
HEADERS += ......
SOURCES += ......
RESOURCES += resources.qrc


And in the class that creates the report, I include these headers:

#include "ncreport.h"
#include "ncreportoutput.h"
#include "ncreportpreviewoutput.h"
#include "info.h"
#include "ncreportpreviewwindow.h"
#include "utils.h"

Then, I compile and everything works great. After that, I add the line

NCReport *report = new NCReport;

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

wirasto
26th January 2010, 18:14
I get the same problem. Have tried several different versions, but always get problem (on Windows) :)

Lesiok
26th January 2010, 18:25
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.

pucara_faa
26th January 2010, 18:36
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.

pucara_faa
27th January 2010, 19:21
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:

DEFINES += NCREPORT_IMPORT
LIBS += bin\ncreport2.dll
INCLUDEPATH += "REPLACE HERE THE PATH TO NCREPORT ROOT FOLDER\include"
QT += xml sql
TEMPLATE = app
DEFINES += QT_NO_DEBUG_OUTPUT

CONFIG += warn_on \
qt \
thread \
release

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


#include "ncreport.h"
#include "ncreportoutput.h"
#include "ncreportpreviewoutput.h"
#include "info.h"
#include "ncreportpreviewwindow.h"
#include "utils.h"


NCReport *report = new NCReport();
report->reset();
report->clearBatch();
report->setReportFile("PATH TO THE REPORT");
report->addItemModel(im, "model1");
report->runReportToPreview();
if (!report->hasError()){
NCReportPreviewWindow *pv = new NCReportPreviewWindow();
pv->setOutput( (NCReportPreviewOutput*)report->output() );
pv->setWindowModality( Qt::ApplicationModal );
pv->setAttribute( Qt::WA_DeleteOnClose );
pv->show();
}

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.

orianabanana
1st March 2010, 21:24
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.

rivci
5th April 2011, 14:36
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 :)