您的位置:首页 > 编程语言 > C语言/C++

QT编译遇到的初级问题整理 gnu-libstdc++\4.9\include\cstdlib:72: error: stdlib.h: No such file or directory

2015-06-18 08:16 726 查看
问题1 使用QT编译Android项目时总是提示头文件编译错误,类似下面

G:\androidsdk\android-ndk-r10d\sources\cxx-stl\gnu-libstdc++\4.9\include\cstdlib:72: error: stdlib.h: No such file or directory

#include <stdlib.h>

G:\androidsdk\android-ndk64-r10-windows-x86_64\android-ndk-r10\sources\cxx-stl\gnu-libstdc++\4.9\include/cwchar:44:19: fatal error: wchar.h: No such file or directory

#include <wchar.h>

^

compilation terminated.

makefile:1080: recipe for target 'xxx.obj' failed

解决方案: ^

来自一个国外网友的解决方案:

https://forum.qt.io/topic/43803/solved-qt-android-cstdlib-error-stdlib-h-no-such-file-or-directory

以下是解决答案:

Solved.

解决方案:It appeared I had a 64-bit NDK installed even though I thought I had downloaded a 32-bit NDK.

I blew away all NDK remnants and downloaded new 32-bit r10 NDK and now my Android x86 emulator is launching my Qt hello world app.

android-ndk32-r10-darwin-x86.tar.bz2

意思是要统一使用32位的NDK,QT Creator.

解决方案:我的解决方案也是这样,我的机器是64位,我NDK安装了64位,但是QTCreator是32位,这样就会有问题,把NDK重新下载一个32位的就OK了

问题2. -1: error: No rule to make target

'G:\androidsdk\android-ndk-r10d\sources\cxx-stl\gnu-libstdc++\4.9\include\utility', needed by 'main.obj'. Stop.

解决方案:删除就得编译配置目录,重新生成就ok了,这个问题是因为问题1的临时文件存在导致的编译错误,解决了问题1,删除工程编译文件重新编译就ok了。

问题3编译错误

Error: Target id 'android--1' is not valid. Use 'android.bat list targets' to get the target ids

Error while building/deploying project XXX(kit: Android for armeabi-v7a (GCC 4.9, Qt 5.4.1))

When executing step "Build Android APK"

-output D:/qt5/qml/qtquickbook/build-touchEvent-Android_for_armeabi_v7a_GCC_4_8_Qt_5_4_1-Release/android-build --deployment bundled --android-platform android--1 --jdk "D:/Program Files/Java/jdk1.7.0_45" --ant D:/qt5/apache-ant-1.9.4/bin/ant.bat

Error: Target id 'android--1' is not valid. Use 'android.bat list targets' to get the target ids.

Generating Android Package

Input file: D:/qt5/qml/qtquickbook/build-touchEvent-Android_for_armeabi_v7a_GCC_4_8_Qt_5_4_1-Release/android-libtouchEvent.so-deployment-settings.json

Output directory: D:/qt5/qml/qtquickbook/build-touchEvent-Android_for_armeabi_v7a_GCC_4_8_Qt_5_4_1-Release/android-build/

Application binary: D:/qt5/qml/qtquickbook/build-touchEvent-Android_for_armeabi_v7a_GCC_4_8_Qt_5_4_1-Release/libtouchEvent.so

Android build platform: android--1

Install to device: No

Buildfile: build.xml does not exist!

Build failed

Warning: Android platform 'android--1' does not exist in SDK.

Building the android package failed!

-- For more information, run this command with --verbose.

When executing step "Build Android APK"

Error while building/deploying project cube (kit: Android for armeabi-v7a (GCC 4.9, Qt 5.4.1))

When executing step "Deploy to Android device"

解决方案:需要设置Build Android APK 里面的 Android Build SDK-》Android -XX(选中目标版本)



^

问题4.编译静态库时需要出错, 提示nternal Error: Could not find .pro file.

Internal Error: Could not find .pro file.

20:37:40: Internal Error: Could not find .pro file.

Error while building/deploying project XXX(kit: Android for armeabi-v7a (GCC 4.9, Qt 5.4.1))

When executing step "Build Android APK"

解决方案:

unable to build lib

Right, I can reproduce that. Creator's android support is focussed around building applications and packaging them into apks. So building only a library (static or not, doesn't matter), is somewhat out of scope for us. To build a library for a application, we expect the user to create a subdirs project with both a library and a application project.

You can work around this problem, by disabling the unnecessary "make install" and "Build apk" steps on the Project's mode under the build settings.

解决方案:

禁用 Build Android APK 选项,就是下图中的蓝色圆饼+斜杠符号的禁用按钮。

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: