/tmp/ccAceHhY.o: In function `main': main.c:(.text+0xc7): undefined reference to `dlopen' main.c:

  写一些调用dlopen函数的程序,编译的时候总是报: /tmp/ccAceHhY.o: In function `main':
main.c:(.text+0xc7): undefined reference to `dlopen'
main.c:(.text+0x11c): undefined reference to `dlsym'
main.c:(.text+0x160): undefined reference to `dlclose'
collect2: ld returned 1 exit status

解决办法:编译的时候加 -ldl,头文件加, dlopen等函数需要链接到libdl.so动态库上。

你可能感兴趣的:(/tmp/ccAceHhY.o: In function `main': main.c:(.text+0xc7): undefined reference to `dlopen' main.c:)