Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Weird editor errors caused by stddef.h
Qt 6.11 is out! See what's new in the release blog

Weird editor errors caused by stddef.h

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
3 Posts 2 Posters 641 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.
  • LorenDBL Offline
    LorenDBL Offline
    LorenDB
    wrote on last edited by
    #1

    Qt Creator is not parsing the include files in my project properly and gives a lot of errors in the IDE, including errors like main.cpp:14:5: error: unknown type name 'QApplication'. However, my project compiles perfectly fine. I am getting tired of all these supposed errors and am wondering if there is any way to fix this issue.

    I had a hunch from a few days ago (I forget exactly how I got this hunch) that stddef.h was causing the problem. So I added #include <stddef.h> to my main.cpp, and Qt Creator gave the error:

    /home/loren/code/klock/main.cpp:12: error: 'stddef.h' file not found
    /usr/include/c++/9/ostream:42: to match this '{'
    

    where the '{' is the beginning { in namespace std.

    My .pro file looks like this:

    QT += core gui widgets
    # The following define makes your compiler emit warnings if you use
    # any Qt feature that has been marked deprecated (the exact warnings
    # depend on your compiler). Please consult the documentation of the
    # deprecated API in order to know how to port your code away from it.
    DEFINES += QT_DEPRECATED_WARNINGS
    
    # You can also make your code fail to compile if it uses deprecated APIs.
    # In order to do so, uncomment the following line.
    # You can also select to disable deprecated APIs only up to a certain version of Qt.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    
    SOURCES += \
        klocktimer.cpp \
        main.cpp \
        klockmainwindow.cpp \
        chronometer.cpp
    
    TRANSLATIONS += \
        klock_en_US.ts \
        klock_es_MX.ts
    
    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
    
    HEADERS += \
        klocktimer.h \
        klockmainwindow.h \
        chronometer.h
    
    jsulmJ 1 Reply Last reply
    0
    • LorenDBL LorenDB

      Qt Creator is not parsing the include files in my project properly and gives a lot of errors in the IDE, including errors like main.cpp:14:5: error: unknown type name 'QApplication'. However, my project compiles perfectly fine. I am getting tired of all these supposed errors and am wondering if there is any way to fix this issue.

      I had a hunch from a few days ago (I forget exactly how I got this hunch) that stddef.h was causing the problem. So I added #include <stddef.h> to my main.cpp, and Qt Creator gave the error:

      /home/loren/code/klock/main.cpp:12: error: 'stddef.h' file not found
      /usr/include/c++/9/ostream:42: to match this '{'
      

      where the '{' is the beginning { in namespace std.

      My .pro file looks like this:

      QT += core gui widgets
      # The following define makes your compiler emit warnings if you use
      # any Qt feature that has been marked deprecated (the exact warnings
      # depend on your compiler). Please consult the documentation of the
      # deprecated API in order to know how to port your code away from it.
      DEFINES += QT_DEPRECATED_WARNINGS
      
      # You can also make your code fail to compile if it uses deprecated APIs.
      # In order to do so, uncomment the following line.
      # You can also select to disable deprecated APIs only up to a certain version of Qt.
      #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
      
      SOURCES += \
          klocktimer.cpp \
          main.cpp \
          klockmainwindow.cpp \
          chronometer.cpp
      
      TRANSLATIONS += \
          klock_en_US.ts \
          klock_es_MX.ts
      
      # Default rules for deployment.
      qnx: target.path = /tmp/$${TARGET}/bin
      else: unix:!android: target.path = /opt/$${TARGET}/bin
      !isEmpty(target.path): INSTALLS += target
      
      HEADERS += \
          klocktimer.h \
          klockmainwindow.h \
          chronometer.h
      
      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @LorenDB Try to disable "ClangCodeModel" plug-in in "Help/About Plugins..."

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      3
      • LorenDBL Offline
        LorenDBL Offline
        LorenDB
        wrote on last edited by
        #3

        Thanks, that fixed it.

        1 Reply Last reply
        1

        • Login

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