【发布时间】:2010-10-31 16:41:12
【问题描述】:
我使用 C++ (Eclipse) 在 Linux 中工作,并且想使用一个库。 Eclipse 显示错误:
undefined reference to 'dlopen'
您知道解决方案吗?
这是我的代码:
#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);
}
【问题讨论】: