Hello,
I want to use winpcap on Qt 4 program, but I have compilation errors if I include pcap header files with Qt headers. Here's an little example :
main.cpp
#include <pcap.h>
#include <remote-ext.h>
#include <QApplication>
#include <QDialog>
int main(int argc, char ** argv)
{
window->show();
return app.exec();
}
#include <pcap.h>
#include <remote-ext.h>
#include <QApplication>
#include <QDialog>
int main(int argc, char ** argv)
{
QApplication app(argc, argv);
QDialog *window = new QDialog;
window->show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
and project file
SOURCES = main.cpp
win32:LIBS += -LC:\WpdPack\Lib -lwpcap
win32:INCLUDEPATH += C:\WpdPack\include
SOURCES = main.cpp
win32:LIBS += -LC:\WpdPack\Lib -lwpcap
win32:INCLUDEPATH += C:\WpdPack\include
To copy to clipboard, switch view to plain text mode
With Visual studio no errors. With minGW :
from C:/Qt/4.1.1-gw/include/QtGui/qapplication.h:1,
from main.cpp:4:
C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/mingw32/bits
/c++locale.h: In function `int std::__convert_from_v(char*, int, const char*, _T
v, int* const&, int)':
C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/mingw32/bits
/c++locale.h:68: error: `snprintf' is not a member of `std'
mingw32-make[1]: *** [release\main.o] Error 1
mingw32-make[1]: Leaving directory `C:/Documents and Settings/jl/Mes documents/e
ssaigcc'
mingw32-make: *** [release] Error 2
from C:/Qt/4.1.1-gw/include/QtGui/qapplication.h:1,
from C:/Qt/4.1.1-gw/include/QtGui/QApplication:1,
from main.cpp:4:
C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/mingw32/bits
/c++locale.h: In function `int std::__convert_from_v(char*, int, const char*, _T
v, int* const&, int)':
C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/mingw32/bits
/c++locale.h:68: error: `snprintf' is not a member of `std'
mingw32-make[1]: *** [release\main.o] Error 1
mingw32-make[1]: Leaving directory `C:/Documents and Settings/jl/Mes documents/e
ssaigcc'
mingw32-make: *** [release] Error 2
To copy to clipboard, switch view to plain text mode
It's the last lines of errors compilation.
If I delete pcap headers, no error. If I delete Qt code and headers, no error !
Thanks for help
Bookmarks