linux g++ undefined reference to `dlopen'类问题

main.cpp:(.text+0x19): undefined reference to `dlopen'
main.cpp:(.text+0x22): undefined reference to `dlerror'
main.cpp:(.text+0x62): undefined reference to `dlsym'
需要在编译时加上-ldl。
将原来的编译命令:g++ cfgfile.cpp create.cpp main.cpp -o main

修改为:g++ cfgfile.cpp create.cpp main.cpp -o main -ldl

另外,如果是进行多线程开发时,在编译时需加上-lpthread

你可能感兴趣的:(linux g++ undefined reference to `dlopen'类问题)