开发者

Why i get an error with cygwin?

开发者 https://www.devze.com 2023-03-08 16:56 出处:网络
static jboolean libinit(JNIEnv *env, jobject obj, jint sdk) { /* #include <sys/system_properties.h>
static jboolean libinit(JNIEnv *env, jobject obj, jint sdk) {
/*
#include <sys/system_properties.h>
   int sdk;
   char c[PROP_VALUE_MAX];
if(__system_property_get("ro.build.version.sdk",c) > 0) sscanf(c,"%d",&sdk);
else sdk = 8;
*/
     __android_log_print(ANDROID_LOG_INFO,"liblossless","libinit: sdk=%d",sdk);
    if(!libhandle) {
        if(sdk < 8) libhandle = dlopen("/data/data/net.avs234/lib/libatrack8.so",     RTLD_NOW);
        else libhandle = dlopen("/data/data/net.avs234/lib/libatrack9.so", RTLD_NOW);
    if(libhandle) {
        libmedia_pause = (typeof(libmedia_pause))     dlsym(libhandle,"libmedia_pause");
    libmedia_resume = (typeof(libmedia_resume)) dlsym(libhandle,"libmedia_resume");
    libmedia_start = (typeof(libmedia_start)) dlsym(libhandle,"libmedia_start");
    libmedia_stop = (typeof(libmedia_stop)) dlsym(libhandle,"libmedia_stop");
    libmedia_write = (typeof(libmedia_write)) dlsym(libhandle,"libmedia_write");
    libmediacb_start = (typeof(libmediacb_start)) dlsym(libhandle,"libmediacb_start");
    libmediacb_stop = (typeof(libmediacb_stop)) dlsym(libhandle,"libmediacb_stop");
        libmediacb_write = (typeof(libmediacb_write)) dlsym(libhandle,"libmediacb_write");
                libmediacb_wait_done = (typeof(libmediacb_wait_done))         dlsym(libhandle,"libmediacb_wait_done");
        }
    }
    __android_log_print(ANDROID_LOG_INFO,"liblossless","libinit: handle=%p",libhandle);
    return libhandle != 0;
}

static jboolean libexit(JNIEnv *env, jobject obj) {
   int ret = 0;
     __android_log_print(ANDROID_LOG_INFO,"liblossless","libexit");
    if(libhandle) {
        ret = dlclose(libhandle) ? 0 : 1;
        libhandle = 0;
    }
    return ret;
}

compile with cygwin give me an error:

    /cygdrive/C/androidndk4/apps/lossless/project/bin/ndk/local/armeabi/objs/lossles

s/main.o: In function libexit': /cygdrive/C/androidndk4/apps/lossless/project/jni/main.c:247: undefined referenc e todlclose' /cygdrive/C/androidndk4/apps/lossless/project/bin/ndk/local/armeabi/objs/lossles s/main.o: In function libinit': /cygdrive/C/androidndk4/apps/lossless/project/jni/main.c:226: undefined referenc e todlopen' /cygdrive/C/androidndk4/apps/lossless/project/jni/main.c:228: undefined referenc e to dlsym' /cygdrive/C/androidndk4/apps/lossless/project/jni/main.c:229: undefined referenc e todlsym' /cygdrive/C/androidndk4/apps/lossless/project/jni/main.c:230: undefined referenc e to dlsym' /cygdrive/C/androidndk4/apps/lossless/project/jni/main.c:231: undefined referenc e todlsym' /cygdrive/C/androidndk4/apps/lossless/project/jni/main.c:232: undefined referenc e to dlsym' /cygdrive/C/androidndk4/apps/lossless/project/bin/ndk/local/armeabi/objs/lossles s/main.o:/cygdrive/C/androidndk4/apps/lossless/project/jni/main.c:233: more unde fined references todlsym' follow /cygdrive/C/androidndk4/apps/lossless/project/bin/ndk/local/armeabi/objs/lossles s/main.o: In function libinit': /cygdrive/C/androidndk4/apps/lossless/project/jni/main.c:225: undefined referenc e todlopen' collect2: ld returned 1 exit status 开发者_StackOverflow社区 make: * [/cygdrive/C/androidndk4/apps/lossless/project/bin/ndk/local/armeabi/l iblossless.so] Error 1


Your errors are mentioning 'undefined references'. This means that the functions you're using (dlopen, dlclose, dlsym, etc) are not defined. Check that you're including the proper header files, and check also that you're correctly linking against the required libraries if those functions come from a shared lib.

0

精彩评论

暂无评论...
验证码 换一张
取 消