Results 1 to 5 of 5

Thread: Problem to compile with MinGW + Qt 4 + winpcap

  1. #1
    Join Date
    Jan 2006
    Posts
    156
    Thanked 12 Times in 12 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Problem to compile with MinGW + Qt 4 + winpcap

    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
    Qt Code:
    1. #include <pcap.h>
    2. #include <remote-ext.h>
    3.  
    4. #include <QApplication>
    5. #include <QDialog>
    6.  
    7. int main(int argc, char ** argv)
    8. {
    9. QApplication app(argc, argv);
    10. QDialog *window = new QDialog;
    11.  
    12. window->show();
    13. return app.exec();
    14. }
    To copy to clipboard, switch view to plain text mode 
    and project file
    Qt Code:
    1. SOURCES = main.cpp
    2. win32:LIBS += -LC:\WpdPack\Lib -lwpcap
    3. win32:INCLUDEPATH += C:\WpdPack\include
    To copy to clipboard, switch view to plain text mode 
    With Visual studio no errors. With minGW :
    Qt Code:
    1. from C:/Qt/4.1.1-gw/include/QtGui/qapplication.h:1,
    2. from C:/Qt/4.1.1-gw/include/QtGui/QApplication:1,
    3. from main.cpp:4:
    4. C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/mingw32/bits
    5. /c++locale.h: In function `int std::__convert_from_v(char*, int, const char*, _T
    6. v, int* const&, int)':
    7. C:/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/mingw32/bits
    8. /c++locale.h:68: error: `snprintf' is not a member of `std'
    9. mingw32-make[1]: *** [release\main.o] Error 1
    10. mingw32-make[1]: Leaving directory `C:/Documents and Settings/jl/Mes documents/e
    11. ssaigcc'
    12. 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

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem to compile with MinGW + Qt 4 + winpcap

    Try:
    Qt Code:
    1. #include <QApplication>
    2. #include <QDialog>
    3.  
    4. #include <pcap.h>
    5. #include <remote-ext.h>
    6.  
    7. int main(int argc, char ** argv)
    8. {
    9. ...
    10. }
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jan 2006
    Posts
    156
    Thanked 12 Times in 12 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem to compile with MinGW + Qt 4 + winpcap

    Thanks you very much ! It's good

    do you have an explanation?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem to compile with MinGW + Qt 4 + winpcap

    Quote Originally Posted by jlbrd
    do you have an explanation?
    Unfortunately not, I've just run into similar problem when I tried to use STL in my application.

  5. #5
    Join Date
    Jan 2006
    Posts
    156
    Thanked 12 Times in 12 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem to compile with MinGW + Qt 4 + winpcap

    Ok thank you

Similar Threads

  1. Qt 4.4.0 + MinGW + MySQL installation problem
    By jambrek in forum Installation and Deployment
    Replies: 2
    Last Post: 1st December 2008, 11:02
  2. Qt 4.3.1 & MinGW 5.1.3 & MSYS 1.0 qmake problem
    By mdecandia in forum Installation and Deployment
    Replies: 2
    Last Post: 2nd October 2008, 16:52
  3. compile with minGW ??
    By eric in forum Qt Programming
    Replies: 4
    Last Post: 8th November 2007, 00:41
  4. Qt with MinGW, compiling problem
    By nileshsince1980 in forum Qt Programming
    Replies: 1
    Last Post: 25th September 2007, 09:00
  5. QtNetwork error by compile MingW qt4.2
    By patrik08 in forum Qt Programming
    Replies: 2
    Last Post: 26th October 2006, 15:09

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.