PDA

View Full Version : realtime_plot example problem--help needed.



swamyonline
11th July 2008, 13:03
hi ppl,
iam trying to copy the realtime_plot example project into my own folder and trying to execute it.

iam doing it in windows with QDevelop.

1. I copied all the .cpp and .h files into my own folder.
2. Created a new project and added those realtime_plot files to it.
3. Set the env variables INCLUDEPATH += c:\qwt-5.1.1\include
LIBS += c:\qwt-5.1.1\lib\libqwt5.a
4. Set project settings to release and warn on.

with those settings, i was able to compile it successfully. But when i tried to execute it, its giving error message "The application failed to intialize properly(0xc0000005). Click on OK to terminate the application".

the project settings file:


TEMPLATE = app
SOURCES += realtime.cpp \
mainwindow.cpp \
randomplot.cpp \
incrementalplot.cpp \
scrollbar.cpp \
scrollzoomer.cpp
CONFIG += release warn_on
HEADERS += mainwindow.h \
randomplot.h \
incrementalplot.h \
realtime.h \
scrollbar.h \
scrollzoomer.h
INCLUDEPATH += c:\qwt-5.1.1\include
LIBS += c:\qwt-5.1.1\lib\libqwt5.a


what could be the real mistake i hv done? im trying execute the same example program without any code modification, except with a new .pro file other than the example .pro file.

Can any body point it out and tell me the problem...thanks in advance.

swamyonline
12th July 2008, 12:48
hi ppl,
it may be a silly problem, but im unable to crack it. pls point it out.

1. main.cpp


#include <QApplication>
#include "mainwindow.h"
int main(int argc,char **argv)
{
QApplication app(argc,argv);
MainWindow win;
win.show();
return app.exec();
}

2. mainwindow.h


#ifndef __MAINWINDOW_H__
#define __MAINWINDOW_H__
#include <QMainWindow>

class MainWindow: public QMainWindow
{
public:
MainWindow();
};

#endif // __MAINWINDOW_H__

3. mainwindow.cpp


#include "mainwindow.h"
MainWindow::MainWindow()
{
qDebug("Test");
}

4. randomplot.h


#ifndef __RANDOMPLOT_H__
#define __RANDOMPLOT_H__
#include<qwt_plot.h>
class MyPlot: public QwtPlot
{
Q_OBJECT
MyPlot();
};
#endif // __RANDOMPLOT_H__

5. randomplot.cpp


#include "randomplot.h"
MyPlot::MyPlot()
{
qDebug("Indent");
}

6. plot.pro


TEMPLATE = app
SOURCES += main.cpp mainwindow.cpp randomplot.cpp
HEADERS += mainwindow.h randomplot.h
CONFIG += release warn_on qt console
QT += core gui
INCLUDEPATH += c:\qwt-5.1.1\src
LIBS += c:\qwt-5.1.1\lib\libqwt5.a


I successfully, compiled the application on QDevelop on Windows XP. But when i tried to execute it, its giving the following error:
The application failed to initialize properly (0x0000005). Click on OK to terminate the application.

whats the problem?
When i removed the Q_OBJECT macro, its executing properly, no error was coming. whats that silly misake, pls suggest... thanks in advance.....bye

jacek
12th July 2008, 22:36
How did you compile Qwt?

P.S. Please don't start more than one thread on the same problem. Also, please, use [code] tags.

swamyonline
13th July 2008, 00:51
thanks jacek for replying.
ya, sure, i will follow code tags from here onwards. and the msg got posted twice accidentally.
i compiled the program within QDevelop with mingw32-make. the commands i followed within propmpt:

qmake
mingw32-make.

what i noticed is, the example programs given with Qwt are including *.pri files in compilation and iam avoiding them as iam writing a complete new .pro file with proper INCLUDEPATH and LIBS arguments. and also, the example programs r creating a ".rc " file which is not created with this simple application.
and also i noticed in the example Makefile.Release is , its compiling the resource file with this command


obj\realtime_resource_res.o: realtime_resource.rc
windres -i realtime_resource.rc -o obj\realtime_resource_res.o --include-dir=.

is there anything to do with the resource file. i hv not included the resource file within my sample program...

pls find it out and suggest me a solution..thank u again.

jacek
14th July 2008, 19:46
i compiled the program within QDevelop with mingw32-make. the commands i followed within propmpt
Did you compile Qwt the same way?

What happens if you change your LIBS variable to:

LIBS += -Lc:\qwt-5.1.1\lib\ -lqwt5?

swamyonline
15th July 2008, 19:59
jacek,
sorry, i was out of station. yes, i tried by changing the library options as u mentioned, but there is no change in the problem. still the problem persists.. but, i was successful on Linux. its executing properly. may be some resources options r missing in compiling it on windows. any way thanks for replies and pls let me know if u find solution for the problem..thank u.. bye

jacek
17th July 2008, 13:07
its executing properly. may be some resources options r missing in compiling it on windows.
No, it's some problem with DLLs. Have you tried copying qwt5.dll to the directory where the executable is? How do you start the application?

Uwe
17th July 2008, 13:42
Did you add "DEFINES += QWT_DLL" to your project file ?

Uwe

swamyonline
17th July 2008, 19:12
uwe,

thanks...finally it got solved on windows with that option. i think, i did not go through the qmake basics properly..now its clear.. thank u very much jacek and uwe...great help... keep going , hv a great time..bye