Important: Please read the Qt Code of Conduct -

Qt Creator, Android, missing stdlib.h compile error

  • I have recently started toying around with writing Qt apps for Android with pretty good success. I am currently using Qt Creator 4.2 on OS X Yosemite 10.10.5 with XCode 7.2.1 Android SDK tools 25.x.x and API level 18 NDK r10e (64-bit).

    On occasion (twice now actually) I ended up in a situation where I can no longer compile a program. The error returned is that the header file stdlib.h cannot be found. It works fine and then all of a sudden, after some trigger event I haven't figured out yet, I can no longer compile a program without this error being returned.

    I think I found a work around when this happens. If I toggle from release to debug mode in Qt Creator (or visa versa) then everything works fine after. When it is working I have no problems (I can compile, sign, and install the app on the device directly from Qt Creator without issue). It is not a problem with the specific mode either. The last time it happened I was in release mode, I changed to debug, compiled, then returned to release mode and the problem disappeared. The first time it happened I believe I was in debug mode.

    When the compile error does happen it is persistent. I tried everything that makes sense (including deleting all files and folders other than the project file, sources, and resources). Switching between debug and release mode (or the reverse) to fix this problem doesn't make a lot of sense but it seems to be the only thing that works.

    Has anyone run into this before? Any ideas of where to look? Is there something related to release/debug mode in Qt Creator that might be corrupting somehow (something that is stored outside the directories of the compiled application)?

  • Moderators

    @Rondog Definitely a weird problem. I would have blamed it on a dirty build (and it still may be) but you said you deleted all the files, i.e. make clean.

    Next time it happens try building on the command line and take Qt Creator out of the equation. So qmake && make clean && make.

    That should help narrow it down. I've never seen that behavior but I never really use qt creator.

  • The next time this happens I am going to be a little more careful of what has changed and what really fixed it. When this happened I wasn't entirely systematic or logical in tracking it down. Moving between debug and release mode must change or reset something that clears this problem.

    I don't normally use QtCreator either but it wraps up a number of steps that makes it easier for Android. Without it I would need to perform these steps manually to turn the program into a signed APK file.

Log in to reply