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 选项,就是下图中的蓝色圆饼+斜杠符号的禁用按钮。
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 选项,就是下图中的蓝色圆饼+斜杠符号的禁用按钮。
相关文章推荐
- 不可或缺 Windows Native (18) - C++: this 指针, 对象数组, 对象和指针, const 对象, const 指针和指向 const 对象的指针, const 对象的引用
- 在c语言中嵌入汇编语句,对于我来说相当难。
- C++中使用std::regex提取lrc歌词文件
- 【C++探索之旅】开宗明义+第一部分第一课:什么是C++?
- 【C++探索之旅】开宗明义+第一部分第一课:什么是C++?
- NotePad++与MinGw的第一次HelloWorld——C语言环境配置说明
- vs2013出现ISO C++ conformant解决办法
- C++静态变量对象的建立和删除,兼论MFC开始运行的起点(全局对象)
- C++字符串转化为数字的库函数
- mystring c++ 自己的string 封装
- c++关于结尾遇到‘\n’或其他特殊字符结束读取的问题(个人总结,大神勿喷)
- C++面试宝典(整理版)3
- Effective C++条款07解读:为多态基类声明virtual析构函数 (某公司招聘面试试题)
- 用Natvis定制C++对象在Visual Studio调试时如何显示
- 【学习笔记】【C语言】变量的内存分析
- 《Effective C++》学习笔记——条款32
- [转]100个经典C语言程序(益智类问题)
- C++--何时需要定义赋值/复制构造函数
- 树的简单c语言实现(先中后序遍历)
- chapter13test3