Linking CXX shared library ..\..\..\..\build\intermediates\cmake\debug\obj\x86\libnative-lib.so FAI

报如下的错:

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\MyMusic181121_2\myplayer\.externalNativeBuild\cmake\debug\x86 --target native-lib}
[1/4] Building CXX object CMakeFiles/native-lib.dir/src/main/cpp/WlFFmpeg.cpp.o
[2/4] Building CXX object CMakeFiles/native-lib.dir/src/main/cpp/native-lib.cpp.o
[3/4] Building CXX object CMakeFiles/native-lib.dir/src/main/cpp/WlAudio.cpp.o

。。。

In file included from D:\work\workplace\studio_workspace\MyMusic181121_2\myplayer\src\main\cpp\native-lib.cpp:4:
D:\work\workplace\studio_workspace\MyMusic181121_2\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\MyMusic181121_2\myplayer\src\main\cpp/WlFFmpeg.h:33:18: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions]
    int duration = 0;
                 ^
36 warnings generated.
[4/4] Linking CXX shared library ..\..\..\..\build\intermediates\cmake\debug\obj\x86\libnative-lib.so
FAILED: cmd.exe /C "cd . && 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 -fPIC -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  -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libnative-lib.so -o ..\..\..\..\build\intermediates\cmake\debug\obj\x86\libnative-lib.so CMakeFiles/native-lib.dir/src/main/cpp/native-lib.cpp.o CMakeFiles/native-lib.dir/src/main/cpp/WlAudio.cpp.o CMakeFiles/native-lib.dir/src/main/cpp/WlCallJava.cpp.o CMakeFiles/native-lib.dir/src/main/cpp/WlFFmpeg.cpp.o CMakeFiles/native-lib.dir/src/main/cpp/WlQueue.cpp.o CMakeFiles/native-lib.dir/src/main/cpp/WlPlaystatus.cpp.o CMakeFiles/native-lib.dir/src/main/cpp/soundtouch/soundtouch/AAFilter.cpp.o CMakeFiles/native-lib.dir/src/main/cpp/soundtouch/soundtouch/cpu_detect_x86.cpp.o CMakeFiles/native-lib.dir/src/main/cpp/soundtouch/soundtouch/FIFOSampleBuffer.cpp.o CMakeFiles/native-lib.dir/src/main/cpp/soundtouch/soundtouch/FIRFilter.cpp.o CMakeFiles/native-lib.dir/src/main/cpp/soundtouch/soundtouch/InterpolateCubic.cpp.o CMakeFiles/native-lib.dir/src/main/cpp/soundtouch/soundtouch/InterpolateLinear.cpp.o CMakeFiles/native-lib.dir/src/main/cpp/soundtouch/soundtouch/InterpolateShannon.cpp.o CMakeFiles/native-lib.dir/src/main/cpp/soundtouch/soundtouch/PeakFinder.cpp.o CMakeFiles/native-lib.dir/src/main/cpp/soundtouch/soundtouch/RateTransposer.cpp.o CMakeFiles/native-lib.dir/src/main/cpp/soundtouch/soundtouch/SoundTouch.cpp.o CMakeFiles/native-lib.dir/src/main/cpp/soundtouch/soundtouch/sse_optimized.cpp.o CMakeFiles/native-lib.dir/src/main/cpp/soundtouch/soundtouch/TDStretch.cpp.o  ../../../../src/main/jniLibs/x86/libavcodec-57.so ../../../../src/main/jniLibs/x86/libavdevice-57.so ../../../../src/main/jniLibs/x86/libavfilter-6.so ../../../../src/main/jniLibs/x86/libavformat-57.so ../../../../src/main/jniLibs/x86/libavutil-55.so ../../../../src/main/jniLibs/x86/libpostproc-54.so ../../../../src/main/jniLibs/x86/libswresample-2.so ../../../../src/main/jniLibs/x86/libswscale-4.so -lOpenSLES -llog -lm "D:/work/tools/depend/android-ndk-r14b-windows-x86_64/android-ndk-r14b/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/libgnustl_static.a" && cd ."
D:\work\workplace\studio_workspace\MyMusic181121_2\myplayer\src\main\cpp/WlAudio.cpp:51: error: undefined reference to 'av_usleep(unsigned int)'
D:\work\workplace\studio_workspace\MyMusic181121_2\myplayer\src\main\cpp/WlAudio.cpp:60: error: undefined reference to 'av_usleep(unsigned int)'
D:\work\workplace\studio_workspace\MyMusic181121_2\myplayer\src\main\cpp/WlAudio.cpp:82: error: undefined reference to 'av_usleep(unsigned int)'
D:\work\workplace\studio_workspace\MyMusic181121_2\myplayer\src\main\cpp/WlAudio.cpp:122: error: undefined reference to 'av_usleep(unsigned int)'

clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

发现是导包的问题,

extern "C" {

#include

};

放在了c限定函数中,就正常了

你可能感兴趣的:(ndk,Exception)