Ninja 在执行时出错

Ninja giving error while executing

我已经使用 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++.8\include  -L"C:\Users\Public\DOCUME~1\ANDROI~1\Studio.0\CATALO~1\ANDROI~1\sources\cxx-stl\GNU-LI~1.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

在构建标志中我可以看到; (分号)存在于每个空格之间。是预期的吗?我做错了什么?

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

cmake -DCMAKE_CXX_FLAGS=-Qunused-arguments

或者,在CMakeLists.txt中:

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