我正在尝试使用nim从Windows在移动设备上使用C语言进行交叉编译。我一直设法编译,但是无法使用USB调试将其导出/推送到手机上 以下是我创建的批处理文件..谁能告诉我怎么了?我只想使用gcc或clang直接编译到我的移动设备上。
@echo off
set PATH=%PATH%;C:/Users/PCTechRinz/AppData/Local/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows/bin
nim c --cpu:arm --os:android --compileOnly hello.nim
path = C:/cygwin/bin
g++ -I../sysroot/usr/include -I/path=D:/Installer/nim-0.19.0/lib -pie -o hello.bin hello.cpp stdlib_system.cpp
path = C:/Users/PCTechRinz/AppData/Local/Android/Sdk/platform-tools
adb root
adb push hello.bin /data/local/tmp/hello.bin
adb shell
cd /data/local/tmp/hello.bin
chmod 755 hello
./hello
pause
下面是我所得到的
Hint: used config file 'D:\Installer\nim-0.19.0\config\nim.cfg' [Conf]
Hint: system [Processing]
Hint: hello [Processing]
Hint: operation successful (12267 lines compiled; 0.268 sec total; 10.773MiB pea
kmem; Debug Build) [SuccessX]
adb: error: failed to get feature set: no devices/emulators found
error: no devices/emulators found
The system cannot find the path specified.
'chmod' is not recognized as an internal or external command,
operable program or batch file.
'.' is not recognized as an internal or external command,
operable program or batch file.
Press any key to continue . . .
我已在手机上启用USB调试
答案 0 :(得分:0)
您必须使用Android工具链为Android构建。系统的g ++针对Windows,而不是Android。
我强烈建议您使用ndk-build或CMake,但是如果出于某些原因需要直接使用Clang,则应该使用standalone toolchain。