相关疑难解决方法(0)

Linux c ++错误:对'dlopen'的未定义引用

我使用C++(Eclipse)在Linux中工作,并希望使用库.Eclipse向我显示错误:

undefined reference to 'dlopen' 
Run Code Online (Sandbox Code Playgroud)

你知道解决方案吗?

这是我的代码:

#include <stdlib.h>
#include <stdio.h>
#include <dlfcn.h>

int main(int argc, char **argv) {
    void *handle;
    double (*desk)(char*);
    char *error;

    handle = dlopen ("/lib/CEDD_LIB.so.6", RTLD_LAZY);
    if (!handle) {
        fputs (dlerror(), stderr);
        exit(1);
    }

    desk= dlsym(handle, "Apply");

    if ((error = dlerror()) != NULL)  {
        fputs(error, stderr);
        exit(1);
    }

    dlclose(handle);
}
Run Code Online (Sandbox Code Playgroud)

c++ eclipse linux

132
推荐指数
6
解决办法
15万
查看次数

标签 统计

c++ ×1

eclipse ×1

linux ×1