android-ndk-profiler 对 monstartup 和 moncleanup 的 undefined reference

标签 android c++ c android-ndk gprof

我正在尝试编译 Android NDK 库以使用 android-ndk-profiler用于分析。

Audio.h中,我有:

extern "C" {
    void monstartup(char const*);
    void moncleanup();
}

Audio.cpp中,我有:

#include "Audio.h"
com_example_native_init(JNIEnv *env, jobject thiz) {
    // Start profiling
    monstartup("libDMAudiolib.so");
    ...
}

我正在编译

ndk-build NDK_MODULE_PATH=/cygdrive/c/ndk_modules

我得到的确切编译错误是

Path/to/Audio.cpp:136: error: undefined reference to 'monstartup'

有没有 android ndk 专家可以告诉我发生了什么事?

最佳答案

听起来monstartup没有被链接(看起来像链接器错误,而不是编译器错误)。

确保您的 Android.mk 具有 Usage page 上显示的添加内容,特别是 LOCAL_STATIC_LIBRARIES 指令。

关于android-ndk-profiler 对 monstartup 和 moncleanup 的 undefined reference ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16949303/

相关文章:

c - 什么信号(SIGPIPE,SIG_IGN);做?

android - 如何避免 Android 中的 session 超时

java - 除非整个盒子都填满,否则不要进入下一个 Activity

c++ - 如何使用 QTextStream 而不是 QDataStream 从 QTableView 进行加载保存?

c++ - 将 OpenCV 的 cv::Mat 转换为 Eigen

c - 为什么 C 编程会给出不同的输出?

javascript - 如何为移动设备制作固定的 div,但在单击时用滚动填充视口(viewport)

android - Ubuntu 上的 Eclipse NDK 路径设置

c++ - 关于单元测试(googletest)和项目/文件夹/文件的混淆

c - 在结构中使用 Option<unsafe fn ...> 的奇怪内存布局