Note that there are some explanatory texts on larger screens.

plurals
  1. POUndefined reference to function in static library with NDK
    primarykey
    data
    text
    <p>So I'm attempting to use libopus on my native code for an Android application. My Android.mk file looks like this:</p> <pre><code>PLATFORM_PREFIX := /opt/android-ext/ LOCAL_PATH := $(PLATFORM_PREFIX)/lib include $(CLEAR_VARS) LOCAL_MODULE := libopus LOCAL_SRC_FILES := libopus.a include $(PREBUILT_STATIC_LIBRARY) # I have to redeclare LOCAL_PATH because the library is in /opt/android-ext/ # and my project is somewhere else. Not very elegant. LOCAL_PATH := /home/sergio/workspace/Project/jni include $(CLEAR_VARS) LOCAL_MODULE := opusUtilsNative LOCAL_SRC_FILES := opusUtilsNative.c LOCAL_C_INCLUDES += $(PLATFORM_PREFIX)/include LOCAL_STATIC_LIBRARIES := android_native_app_glue libopus include $(BUILD_SHARED_LIBRARY) </code></pre> <p>And my code in opusUtilsNative.c looks like this:</p> <pre><code>#include "opusUtilsNative.h" #include &lt;opus/opus.h&gt; #include &lt;opus/opus_types.h&gt; JNIEXPORT jbyteArray JNICALL Java_Project_OpusUtils_encode (JNIEnv * je, jclass jc, jbyteArray data){ int rc; opus_int16 * testOutBuffer; unsigned char* opusBuffer; OpusDecoder *dec; dec = opus_decoder_create(48000, 2, &amp;rc); return data; } </code></pre> <p>And when I try to build it, it works fine <strong>only if I remove the line that uses the "opus_decoder_create" function</strong>. Else I will get this:</p> <pre><code>error: undefined reference to 'opus_decoder_create' </code></pre> <p>I can see that opus_decoder_create is clearly defined on opus.h, which is clearly being included since if I exclude that line, I'll get an error regarding the opus_int16 and OpusDecoder declarations. How come some definitions are being included and some aren't?</p> <p>Any help will be greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload