Stdlib.h: No such file or directory



  • Just installed QT Mobile. I the basic QT Quick project by clicking the "New Project" button. The project compiles just fine when I target the Windows desktop but when I select to build for Android, I get the message "stdlib.h: No such file or directory"

    Probably a very simple problem but I haven't touched QT or c++ development in years and I can't seem to figure out what is wrong.



  • Well. I found that creating any new project works just fine. That is what I did but after a few days of development, the problem is back. I have no idea what I did to cause it and I can't find any difference between a functional project and the broken one.

    Specifically, the error is:

    C:\Devel\android-ndk-r9c\sources\cxx-stl\gnu-libstdc++\4.8\include\cstdlib:72: error: stdlib.h: No such file or directory
    #include <stdlib.h>

    Where is the path for this configured? I could manually point to the correct location but that would break depending on the build target (ie. android or windows). The program still compiles on windows just fine.

    Glenn



  • Can anyone tell me how QT handles the search path? Obviously it is doing something to use different includes depending on the target but I don't see what could possibly be wrong.



  • did you mean that initially you are able to build for both targets and then at some point the android target build gets messed up?

    although, i'm not very familiar with the windows platform,
    i can tell you that everything(?) starts from the qmake spec file that you are using in your project.
    mkspecs are located under your Qt installation folder, e.g. for me that i use GNU/Linux and GNU gcc

    @/opt/Qt5.2.0/5.2.0/gcc/mkspecs/@

    each directory in there can be used as a platform target reference in your qmake file, in case you need to do different actions per target when you are developing across different platforms

    the mkspec file that you are using, also has some default values, where you augment/alter them with your project specific .pro file

    so, if i take a peek into my e.g.

    @
    /opt/Qt5.1.0/5.1.0/gcc/mkspecs/android-g++/qmake.conf
    @

    i can find a value like

    @
    QMAKE_ANDROID_PLATFORM_INCDIR = $$NDK_ROOT/platforms/$$ANDROID_PLATFORM/arch-$$ANDROID_ARCHITECTURE/usr/include
    @

    if you recursively look up those qmake variables and also check what other files are include it by it, you will eventually arrive at the truth :)

    this is the hard way though, you could echo the relevant variables in your .pro or even the generated make file


Log in to reply
 

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