忍者在执行时给出错误

时间:2017-10-28 08:01:04

标签: command-line cmake ninja

我使用Cmake创建了Ninja文件。当我执行忍者文件时,它会显示以下命令

cmd.exe /C "cmd.exe /C "cd /D C:\Users\user\OneDrive\Documents\GitHub\android-cmake-example-discordia\build && "C:\Program Files\CMake\bin\cmake.exe" -E remove_directory C:/Users/user/OneDrive/Documents/GitHub/android-cmake-example-discordia/build/apk/libs && cd /D C:\Users\user\OneDrive\Documents\GitHub\android-cmake-example-discordia\build && "C:\Program Files\CMake\bin\cmake.exe" -E make_directory C:/Users/user/OneDrive/Documents/GitHub/android-cmake-example-discordia/build/apk/libs && cd /D C:\Users\user\OneDrive\Documents\GitHub\android-cmake-example-discordia\build && "C:\Program Files\CMake\bin\cmake.exe" -E make_directory C:/Users/user/OneDrive/Documents/GitHub/android-cmake-example-discordia/build/apk/res && cd /D C:\Users\user\OneDrive\Documents\GitHub\android-cmake-example-discordia\build && "C:\Program Files\CMake\bin\cmake.exe" -E copy_directory C:/Users/user/OneDrive/Documents/GitHub/android-cmake-example-discordia/android/res C:/Users/user/OneDrive/Documents/GitHub/android-cmake-example-discordia/build/apk/res/ && cd /D C:\Users\user\OneDrive\Documents\GitHub\android-cmake-example-discordia\build && "C:\Program Files\CMake\bin\cmake.exe" -E make_directory C:/Users/user/OneDrive/Documents/GitHub/android-cmake-example-discordia/build/apk/src && cd /D C:\Users\user\OneDrive\Documents\GitHub\android-cmake-example-discordia\build && "C:\Program Files\CMake\bin\cmake.exe" -E copy_directory C:/Users/user/OneDrive/Documents/GitHub/android-cmake-example-discordia/android/src C:/Users/user/OneDrive/Documents/GitHub/android-cmake-example-discordia/build/apk/src/ && cd /D C:\Users\user\OneDrive\Documents\GitHub\android-cmake-example-discordia\build && "C:\Program Files\CMake\bin\cmake.exe" -E remove_directory C:/Users/user/OneDrive/Documents/GitHub/android-cmake-example-discordia/build/apk/assets && cd /D C:\Users\user\OneDrive\Documents\GitHub\android-cmake-example-discordia\build && "C:\Program Files\CMake\bin\cmake.exe" -E make_directory C:/Users/user/OneDrive/Documents/GitHub/android-cmake-example-discordia/build/apk/assets/ && cd C:\Users\user\OneDrive\Documents\GitHub\android-cmake-example-discordia\build" && C:\mydir\Backup\dev\tp\bin\myandroidcompiler.exe  -std=c++11 -ffor-scope -fno-exceptions -pipe -ffunction-sections -fdata-sections -ffast-math -pedantic -Werror -Wnon-virtual-dtor -Wsign-promo -fvisibility=hidden -fvisibility-inlines-hidden -Os -ftree-vectorize -g -fno-limit-debug-info -fborland-extensions -fborland-auto-refcount  -fexceptions -fcxx-exceptions -mstackrealign -fno-spell-checking -x c++ -std=c++11 -O0 -fmath-errno -nobuiltininc   -shared  -o libandroidcmakeexample.so CMakeFiles\androidcmakeexample.dir\src\main.cpp.obj -L=\usr\include  -LC:\Users\Public\Documents\Android\AndroidNDK-9c_x86\sources\cxx-stl\gnu-libstdc++\4.8\include  -L"C:\Users\Public\DOCUME~1\ANDROI~1\Studio\20.0\CATALO~1\ANDROI~1\sources\cxx-stl\GNU-LI~1\4.8\libs\ARMEAB~1\include "  -LC:\Users\Public\Documents\Android\AndroidNDK-9c_x86\sources\android\native_app_glue -llog -landroid && cmd.exe /C "cd /D C:\Users\user\OneDrive\Documents\GitHub\android-cmake-example-discordia\build && "C:\Program Files\CMake\bin\cmake.exe" -E copy_directory C:/Users/user/OneDrive/Documents/GitHub/android-cmake-example-discordia/libs C:/Users/user/OneDrive/Documents/GitHub/android-cmake-example-discordia/build/apk/libs/ && cd /D C:\Users\user\OneDrive\Documents\GitHub\android-cmake-example-discordia\build && android update project -t android-10 --name androidcmakeexample --path C:/Users/user/OneDrive/Documents/GitHub/android-cmake-example-discordia/build/apk && cd /D C:\Users\user\OneDrive\Documents\GitHub\android-cmake-example-discordia\build && "C:\Program Files\CMake\bin\cmake.exe" -E copy_directory C:/Users/user/OneDrive/Documents/GitHub/android-cmake-example-discordia/assets C:/Users/user/OneDrive/Documents/GitHub/android-cmake-example-discordia/build/apk/assets/ && cd /D C:\Users\user\OneDrive\Documents\GitHub\android-cmake-example-discordia\build\apk && ant debug""

myandroidcompiler.exe: error: argument unused during compilation: '-nobuiltininc'
myandroidcompiler.exe: error: argument unused during compilation: '-nostdinc++'
ninja: build stopped: subcommand failed.

我也试过删除这些参数。但是这个错误仍然存​​在。过去两天我一直坚持这个问题。任何帮助都将受到高度赞赏。

当我检查CMakeoutput.log文件时,它有以下文字:

The target system is: ANDROID64 -  - 
The host system is: Windows - 10.0.15063 - AMD64
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: C:/mydir/Backup/dev/tp/bin/bccaarm.exe 
Build flags: ;;-idirafter;C:/Android/android-ndk-r15c/platforms/android-14/arch-arm/usr/include;-idirafter;C:/Android/android-ndk-r15c/sources/cxx-stl/gnu-libstdc++/4.9/include;-idirafter;C:/Android/android-ndk-r15c/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include;-idirafter;C:/Android/android-ndk-r15c/sources/android/native_app_glue;-I;c:/accolite/backup/dev/tp/include/android/fmx;;;-idirafter;C:/Android/android-ndk-r15c/platforms/android-14/arch-arm/usr/include;-idirafter;C:/Android/android-ndk-r15c/sources/cxx-stl/gnu-libstdc++/4.9/include;-idirafter;C:/Android/android-ndk-r15c/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include;-idirafter;C:/Android/android-ndk-r15c/sources/android/native_app_glue;-I;c:/accolite/backup/dev/tp/include/android/fmx;;-idirafter;C:/Android/android-ndk-r15c/platforms/android-14/arch-arm/usr/include;-idirafter;C:/Android/android-ndk-r15c/sources/cxx-stl/gnu-libstdc++/4.9/include;-idirafter;C:/Android/android-ndk-r15c/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include;-idirafter;C:/Android/android-ndk-r15c/sources/android/native_app_glue;-I;c:/accolite/backup/dev/tp/include/android/fmx;

Id标志:-c

输出结果为:    0

在构建标志中,我可以看到; (分号)存在于每个空间之间。它有望吗?我做错了什么?

1 个答案:

答案 0 :(得分:2)

添加-Qunused-arguments编译器标志应该可以消除这些错误。 尝试将以下内容添加到CMake命令行:

cmake -DCMAKE_CXX_FLAGS=-Qunused-arguments

或者,在CMakeLists.txt

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments")