PDA

View Full Version : Unable to successfully create Qt application



remy06
25th April 2009, 11:36
Hi all,
I've downloaded and installed "qt-sdk-win-opensource-2009.01.1" with Qtcreator on windows xp.I'm new to Qt and I'm trying to build an application that uses winpcap but have encountered some issues that needs advice.

1) After installation I've manually set the environment variables for PATH,QTDIR and QMAKESPEC as mine does not show these 3 variables after installation. I've created a Qt4 GUI application project and added the following to .pro file and main.cpp:
my .pro file looks like:

TARGET = HelloQtGUI
TEMPLATE = app

SOURCES += main.cpp\
helloqtgui.cpp

HEADERS += helloqtgui.h

FORMS += helloqtgui.ui

win32:LIBS += -Ld:/proj/WpdPack402/Lib -lwpcap
win32:INCLUDEPATH += d:/proj/WpdPack402/Include
while my main.cpp looks like:

#include <QtGui/QApplication>
#include "helloqtgui.h"
#include <pcap.h>

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

//Testing portion of code
char *dev,errbuf[PCAP_ERRBUF_SIZE];
//Retrieve the device list from the local machine
dev = pcap_lookupdev(errbuf);
if (dev == NULL)
{
fprintf(stderr, "Couldn't find default device: %s\n", errbuf);
return(2);
}
printf("Device: %s\n", dev);

return a.exec();
}

However,when I hit Ctrl+R to run it i get the following application output message and the blank GUI main window does not pop up:

Starting D:/proj/HelloQtGUI/debug/HelloQtGUI.exe...

D:/proj/HelloQtGUI/debug/HelloQtGUI.exe exited with code -1073741515
I tried to run the executable in debug folder but an error with "The application has failed to start because wpcap.dll was not found.Re-installing the application may fix this problem".There seems to be no compilation issues.If I were to remove the "Testing portion" of winpcap code then it works fine.

Then I removed the environment variables (since initially installation does not add them) and rerun my application but now I get this message when I tried to run my executable:
"The application has failed to start because mingwm10.dll was not found.Re-installing the application may fix this problem".

Is there any solution for this??

2) If my application uses winpcap libraries and required to be able to run on different versions of windows like xp and vista,which deployment will be more appropriate to use,static or shared libraries?Perhaps can someone provide me a clearer picture of this?

Thanks in advance.Appreciate any help.

faldzip
25th April 2009, 13:51
try to copy wpcap.dll to your application dir (where your .exe file is).