Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Ubuntu Linux, stdlib.h not found...



  • Hello,

    I've been using Qt Creator for a year on Ubuntu Linux to create desktop applications.
    I started to have "stdlib.h not found" errors, even if the file is present.

    Here is an error dump from Qt Creator IDE:

    /usr/include/c++/7/cstdlib:75: erreur : stdlib.h: No such file or directory
    In file included from /usr/include/c++/7/bits/stl_algo.h:59:0,
                     from /usr/include/c++/7/algorithm:62,
                     from /home/newtrax/Qt/5.9/gcc_64/include/QtCore/qglobal.h:109,
                     from /home/newtrax/Qt/5.9/gcc_64/include/QtCore/qalgorithms.h:43,
                     from /home/newtrax/Qt/5.9/gcc_64/include/QtCore/qdebug.h:44,
                     from /home/newtrax/Qt/5.9/gcc_64/include/QtCore/QDebug:1,
                     from SafsMethodParser.cpp:1:
    /usr/include/c++/7/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
     #include_next <stdlib.h>
                   ^~~~~~~~~~
    

    I've got the same message from the free and commercial versions.

    I've tried the following, without success

    • clean and re-run qmake and compile
    • wipe the project clean and get a fresh copy from Git repo
    • update cmake
    • update g++
    • With Manage Toolkits... check if there aren't any errors/warnings (none)

    Here's some basic information about my workstation:

    uname -a
    Linux ubuntu16 4.15.0-121-generic #123-Ubuntu SMP Mon Oct 5 16:16:40 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
    

    Any pointers?

    Thanks!



  • @ve2ymv

    I started to have "stdlib.h not found" errors, even if the file is present.

    Present where?

    include_next <stdlib.h>

    I'm not familiar with that directive. Googling for include_next stdlib.h will doubtless give you enough links to solve your issue.



  • Found it! The #include_next directive is a rather unusual one , and best explained with an example: suppose you have an include file path set to /usr/include and also /usr/local/include as an alternate path. Also suppose that both contains the stdlib.h file. #include_next will skip the one from /usr/include and pick the one in /usr/local/include.

    My problem was that I had a stray include path in my .pro file:

    INCLUDEPATH += /usr/include
    

    So I commented that one out and it compiled again. I guess that it broke the search order for C standard headers.


Log in to reply