我正在运行以下命令:
gcc -DPJ_AUTOCONF = 1 -fPIC -DPJ_IS_BIG_ENDIAN = 0 -DPJ_IS_LITTLE_ENDIAN = 1 -I / usr / local / include -L / usr / local / lib -lpjsua-x86_64-unknown-linux-gnu -lpjsip-ua-x86_64 -unknown-linux-gnu -lpjsip-simple-x86_64-unknown-linux-gnu -lpjsip-x86_64-unknown-linux-gnu -lpjmedia-codec-x86_64-unknown-linux-gnu -lpjmedia-videodev-x86_64-unknown-linux -gnu -lpjmedia-x86_64-unknown-linux-gnu -lpjmedia-audiodev-x86_64-unknown-linux-gnu -lpjnath-x86_64-unknown-linux-gnu -lpjlib-util-x86_64-unknown-linux-gnu -lresample-x86_64 -unknown-linux-gnu -lmilenage-x86_64-unknown-linux-gnu -lsrtp-x86_64-unknown-linux-gnu -lgsmcodec-x86_64-unknown-linux-gnu -lspeex-x86_64-unknown-linux-gnu -lilbccodec-x86_64 -unknown-linux-gnu -lg7221codec-x86_64-unknown-linux-gnu -lportaudio-x86_64-unknown-linux-gnu -lpj-x86_64-unknown-linux-gnu -lm -lnsl -lrt -lpthread -lcrypto -lssl pjsuaCreate。 c
pjsuaCreate.c的内容是:
#include <pjsua-lib/pjsua.h>
int main(int argc, char *argv[])
{
pj_status_t status = pjsua_create();
return 0;
}
我得到了:
/tmp/cc7U0i1Q.o: In function `main': pjsuaCreate.c:(.text+0x10): undefined reference to `pjsua_create'
collect2: ld returned 1 exit status
我在Ubuntu上做grep演示如下:
$ grep -r "pjsua_create" /usr/local/lib/
Binary file /usr/local/lib/python2.7/dist-packages/_pjsua.so matches
Binary file /usr/local/lib/libpjsua-x86_64-unknown-linux-gnu.a matches
答案 0 :(得分:0)
由于至少有一些库是静态的(归档),您可能会遇到here所描述的依赖性排序问题。
分别在-l<lib1> -l<lib2> ...
和-Wl,--start-group
选项(链接器标志)之间包含-Wl,--end-group
选项。