Build command failed. Error while executing process 错误

android ndk项目有时编译会报这样的错,但你又不清楚到底哪儿出错了

Build command failed.
Error while executing process D:\work\adt-bundle\sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {--build D:\work\workplace\studio_workspace\MyMusic181114_4\myplayer\.externalNativeBuild\cmake\debug\x86 --target native-lib}
[1/2] Building CXX object CMakeFiles/native-lib.dir/src/main/cpp/WlFFmpeg.cpp.o
FAILED: D:\work\tools\depend\android-ndk-r14b-windows-x86_64\android-ndk-r14b\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe  --target=i686-none-linux-android --gcc-toolchain=D:/work/tools/depend/android-ndk-r14b-windows-x86_64/android-ndk-r14b/toolchains/x86-4.9/prebuilt/windows-x86_64 --sysroot=D:/work/tools/depend/android-ndk-r14b-windows-x86_64/android-ndk-r14b/platforms/android-22/arch-x86  -Dnative_lib_EXPORTS -I../../../../src/main/cpp/include -isystem D:/work/tools/depend/android-ndk-r14b-windows-x86_64/android-ndk-r14b/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem D:/work/tools/depend/android-ndk-r14b-windows-x86_64/android-ndk-r14b/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/include -isystem D:/work/tools/depend/android-ndk-r14b-windows-x86_64/android-ndk-r14b/sources/cxx-stl/gnu-libstdc++/4.9/include/backward -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mstackrealign -Wa,--noexecstack -Wformat -Werror=format-security  -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mstackrealign -Wa,--noexecstack -Wformat -Werror=format-security  -frtti -fexceptions -O0 -fno-limit-debug-info -O0 -fno-limit-debug-info  -fPIC -MD -MT CMakeFiles/native-lib.dir/src/main/cpp/WlFFmpeg.cpp.o -MF CMakeFiles\native-lib.dir\src\main\cpp\WlFFmpeg.cpp.o.d -o CMakeFiles/native-lib.dir/src/main/cpp/WlFFmpeg.cpp.o -c D:\work\workplace\studio_workspace\MyMusic181114_4\myplayer\src\main\cpp\WlFFmpeg.cpp
In file included from D:\work\workplace\studio_workspace\MyMusic181114_4\myplayer\src\main\cpp\WlFFmpeg.cpp:6:
In file included from D:\work\workplace\studio_workspace\MyMusic181114_4\myplayer\src\main\cpp/WlFFmpeg.h:10:
In file included from D:\work\workplace\studio_workspace\MyMusic181114_4\myplayer\src\main\cpp/WlAudio.h:8:
In file included from D:\work\workplace\studio_workspace\MyMusic181114_4\myplayer\src\main\cpp/WlQueue.h:11:
D:\work\workplace\studio_workspace\MyMusic181114_4\myplayer\src\main\cpp/WlPlaystatus.h:13:15: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions]
    bool load = true;

........

../../../../src/main/cpp/include\libavformat/avformat.h:2042:6: note: candidate function not viable: no known conversion from 'AVFormatContext **' to 'AVFormatContext *' for 1st argument; remove &
void avformat_free_context(AVFormatContext *s);
     ^
21 warnings
ninja: build stopped: subcommand failed.
 

你会发现最后只有waring,没有error,又不知道哪错了

这时你把项目clean一下,又报错,无视

再rebuild一下,又报错,继续无视,

现在再编译 ,报错了,你会发现,堆栈的最后打出了错误信息

In file included from D:\work\workplace\studio_workspace\MyMusic181114_4\myplayer\src\main\cpp\WlFFmpeg.cpp:6:
D:\work\workplace\studio_workspace\MyMusic181114_4\myplayer\src\main\cpp/WlFFmpeg.h:31:15: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions]
    bool exit = false;
              ^
D:\work\workplace\studio_workspace\MyMusic181114_4\myplayer\src\main\cpp\WlFFmpeg.cpp:222:9: error: no matching function for call to 'avformat_free_context'
        avformat_free_context(&avFormatContext);
        ^~~~~~~~~~~~~~~~~~~~~
../../../../src/main/cpp/include\libavformat/avformat.h:2042:6: note: candidate function not viable: no known conversion from 'AVFormatContext **' to 'AVFormatContext *' for 1st argument; remove &
void avformat_free_context(AVFormatContext *s);
     ^
21 warnings and 1 error generated.
ninja: build stopped: subcommand failed.

这时你可以根据提示进行修改了!!

猜你喜欢

转载自blog.csdn.net/lv18092081172/article/details/84070320