stdexcept在Android上

时间:2010-04-23 16:06:48

标签: android compilation android-ndk soundtouch

我正在尝试在Android上编译SoundTouch。我从这个配置行开始:

./ configure CPPFLAGS =“ - I / Volumes / android-build / mydroid / development / ndk / build / platforms / android-3 / arch-arm / usr / include /”LDFLAGS =“ - Wl,-rpath- link = / Volumes / android-build / mydroid / development / ndk / build / platforms / android-3 / arch-arm / usr / lib -L ​​/ Volumes / android-build / mydroid / development / ndk / build / platforms / android -3 / arch-arm / usr / lib -nostdlib -lc“--host = arm-eabi --enable-shared = yes CFLAGS =” - nostdlib -O3 -mandroid“host_alias = arm-eabi --no-create - -no递归

因为Android NDK以ARM为目标,所以我还必须更改Makefile以删除-msse2标志以进行。

当我跑'make'时,我得到:

/bin/sh ../../libtool --tag=CXX   --mode=compile arm-eabi-g++ -DHAVE_CONFIG_H -I. -I../../include -I../../include  -I/Volumes/android-build/mydroid/development/ndk/build/platforms/android-3/arch-arm/usr/include/ -O3 -fcheck-new -I../../include -g -O2 -MT FIRFilter.lo -MD -MP -MF .deps/FIRFilter.Tpo -c -o FIRFilter.lo FIRFilter.cpp
libtool: compile:  arm-eabi-g++ -DHAVE_CONFIG_H -I. -I../../include -I../../include -I/Volumes/android-build/mydroid/development/ndk/build/platforms/android-3/arch-arm/usr/include/ -O3 -fcheck-new -I../../include -g -O2 -MT FIRFilter.lo -MD -MP -MF .deps/FIRFilter.Tpo -c FIRFilter.cpp -o FIRFilter.o
FIRFilter.cpp:46:21: error: stdexcept: No such file or directory
FIRFilter.cpp: In member function 'virtual void soundtouch::FIRFilter::setCoefficients(const soundtouch::SAMPLETYPE*, uint, uint)':
FIRFilter.cpp:177: error: 'runtime_error' is not a member of 'std'
FIRFilter.cpp: In static member function 'static void* soundtouch::FIRFilter::operator new(size_t)':
FIRFilter.cpp:225: error: 'runtime_error' is not a member of 'std'
make[2]: *** [FIRFilter.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1

这并不奇怪,因为需要使用-nostdlib标志。 Android似乎既没有stdexcept也没有stdlib。 如何通过这个编辑SoundTouch的块?

猜测,我可能会使用一些我不知道的旗帜。我可以重构代码不使用stdexcept。可能有一种方法可以引入原始的stdexcept源并引用它。我或许可以链接到预编译的stdexcept库。

1 个答案:

答案 0 :(得分:2)

随android ddk提供的默认提供的gcc版本不支持异常。有关替代版本,请参阅http://www.crystax.net/android/ndk.php