cstdef:No such file or directory

  • Hi all,
    I am a new user for Qt and Nvidia TK1. Currently, I try to build a code on ubuntu of PC, but I suffer some problems. Is anyone able to give me some suggestions? Thanks a lot.

    1. the toolchain is /usr/bin/g++-4.8 of ubuntu
      2.the Qt version is 5.7.0
    2. the error message is listed as below,
      In file included from /opt/Qt5.7.0/5.7/gcc_64/include/QtGui/qwindowdefs.h:43:0,
      from /opt/Qt5.7.0/5.7/gcc_64/include/QtWidgets/qwidget.h:43,
      from /opt/Qt5.7.0/5.7/gcc_64/include/QtWidgets/qmainwindow.h:43,
      from /opt/Qt5.7.0/5.7/gcc_64/include/QtWidgets/QMainWindow:1,
      from SMPCodeReader/mainwindow.h:4,
      from SMPCodeReader/main.cpp:1:
      /opt/Qt5.7.0/5.7/gcc_64/include/QtCore/qglobal.h:45:21: fatal error: cstddef: No such file or directory

    include <cstddef>


    compilation terminated.
    make: *** [main.o] Error 1

  • Hi,
    there is probably something wrong with your installation of gcc. Usually the include files are not under "/opt". BTW: which Ubuntu do you speak of? 14.04 LTS? I build Qt 5.7.0 there quite some time ago and did not have any such problem.
    I would look if "cstddef" really is not in gcc's include directories. You could create yourself a link to "stddef.h" and try again. But there maybe other problems to come with other includes.

  • @m.sue Thanks.

    1. I tyr the example file of Qt5.7, I see the same problem. :(
    2. I use ubuntu-14.04.5-desktop-amd64.iso to install my ubuntu.

  • Qt Champions 2017

    Did you install the dev packages, e.g. http://packages.ubuntu.com/precise/libc6-dev?

  • hi all,
    Thanks for your reply. I think it is a problem in my ubuntu.
    Maybe I made a mistake, so I could not see any of the header files in /use/include.
    After I reinstalling the ubuntu , It is ok. Thanks a lot. :)

Log in to reply

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