Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Errors with include qtwidget
Qt 6.11 is out! See what's new in the release blog

Errors with include qtwidget

Scheduled Pinned Locked Moved General and Desktop
10 Posts 3 Posters 5.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    @
    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'

    @

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

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

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          i will do that in minutes.

          1 Reply Last reply
          0
          • raven-worxR Offline
            raven-worxR Offline
            raven-worx
            Moderators
            wrote on last edited by
            #5

            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?

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            1 Reply Last reply
            0
            • ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #6

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

              i use qt 5.0.1 on ubuntu

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

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

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #8

                  so how can i create interface for that?

                  1 Reply Last reply
                  0
                  • raven-worxR Offline
                    raven-worxR Offline
                    raven-worx
                    Moderators
                    wrote on last edited by
                    #9

                    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.

                    --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                    If you have a question please use the forum so others can benefit from the solution in the future

                    1 Reply Last reply
                    0
                    • ? Offline
                      ? Offline
                      A Former User
                      wrote on last edited by
                      #10

                      thanks i will test them.

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved