Errors with include qtwidget



  • @
    Hi, i create a gui project and delete main.cpp.
    i add libpcap and ndpi libs to project.
    i run simple ndpi example in it's package and it works good (print every thing with printf).
    when include <qtwidget> it has 346 error.
    @
    why?
    this is part of errors:
    @
    In file included from /opt/Qt5.0.1/5.0.1/gcc/include/QtCore/qobjectdefs.h:45:0,
    from /opt/Qt5.0.1/5.0.1/gcc/include/QtGui/qwindowdefs.h:46,
    from /opt/Qt5.0.1/5.0.1/gcc/include/QtWidgets/qwidget.h:45,
    from /opt/Qt5.0.1/5.0.1/gcc/include/QtWidgets/QWidget:1,
    from ../untitled6/pcapReader.c:44:
    /opt/Qt5.0.1/5.0.1/gcc/include/QtCore/qnamespace.h:53:1: error: unknown type name 'namespace'
    /opt/Qt5.0.1/5.0.1/gcc/include/QtCore/qnamespace.h:57:4: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token
    /opt/Qt5.0.1/5.0.1/gcc/include/QtCore/qnamespace.h:1542:33: error: expected ')' before ':' token
    /opt/Qt5.0.1/5.0.1/gcc/include/QtCore/qnamespace.h:1565:1: warning: data definition has no type or storage class [enabled by default]
    /opt/Qt5.0.1/5.0.1/gcc/include/QtCore/qnamespace.h:1565:1: warning: type defaults to 'int' in declaration of 'class' [-Wimplicit-int]
    /opt/Qt5.0.1/5.0.1/gcc/include/QtCore/qnamespace.h:1565:21: error: expected ',' or ';' before 'QInternal'
    In file included from /opt/Qt5.0.1/5.0.1/gcc/include/QtCore/qobjectdefs.h:47:0,
    from /opt/Qt5.0.1/5.0.1/gcc/include/QtGui/qwindowdefs.h:46,
    from /opt/Qt5.0.1/5.0.1/gcc/include/QtWidgets/qwidget.h:45,
    from /opt/Qt5.0.1/5.0.1/gcc/include/QtWidgets/QWidget:1,
    from ../untitled6/pcapReader.c:44:
    /opt/Qt5.0.1/5.0.1/gcc/include/QtCore/qobjectdefs_impl.h:53:1: error: unknown type name 'namespace'
    /opt/Qt5.0.1/5.0.1/gcc/include/QtCore/qobjectdefs_impl.h:53:21: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token
    In file included from /opt/Qt5.0.1/5.0.1/gcc/include/QtGui/qwindowdefs.h:46:0,
    from /opt/Qt5.0.1/5.0.1/gcc/include/QtWidgets/qwidget.h:45,
    from /opt/Qt5.0.1/5.0.1/gcc/include/QtWidgets/QWidget:1,
    from ../untitled6/pcapReader.c:44:
    /opt/Qt5.0.1/5.0.1/gcc/include/QtCore/qobjectdefs.h:54:1: error: unknown type name 'class'

    @


  • Lifetime Qt Champion

    Hi,

    Could you rewrite your post ? Right now there's not much thing we can really read on it


  • Lifetime Qt Champion

    Could you share your pro file and code ? Without it it will be difficult to see where the problem might come from



  • i will do that in minutes.


  • Moderators

    what are the extensions of your source files? Are they anything else then 'cpp'?
    Are you trying to compile your C++ application with with C settings? What Qt package do you use?



  • this is pcabreader.c
    http://hostcode.sourceforge.net/view/964

    i use qt 5.0.1 on ubuntu


  • Lifetime Qt Champion

    Then there's you problem, you are trying to compile Qt code using a c compiler rather than c++.



  • so how can i create interface for that?


  • Moderators

    easiest would probably be to rename "pcabreader.c" to "pcabreader.cpp" if thats possible.
    Otherwise keep your C++/Qt stuff away from your C-only stuff.



  • thanks i will test them.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.