编译PJSIP示例

时间:2017-04-12 15:43:50

标签: gcc makefile compiler-errors pjsip

我正在尝试编译this tutorial之后的PJSIP示例,但我在make之后出现了这些错误:

cc     simple_pjsua.c   -o simple_pjsua
/tmp/ccxmvFQD.o: In function `on_incoming_call':
simple_pjsua.c:(.text+0x40): undefined reference to `pjsua_call_get_info'
simple_pjsua.c:(.text+0x45): undefined reference to `pj_log_get_level'
simple_pjsua.c:(.text+0x6f): undefined reference to `pj_log_3'
simple_pjsua.c:(.text+0x8b): undefined reference to `pjsua_call_answer'
/tmp/ccxmvFQD.o: In function `on_call_state':
simple_pjsua.c:(.text+0xe0): undefined reference to `pjsua_call_get_info'
simple_pjsua.c:(.text+0xe5): undefined reference to `pj_log_get_level'
simple_pjsua.c:(.text+0x119): undefined reference to `pj_log_3'
/tmp/ccxmvFQD.o: In function `on_call_media_state':
simple_pjsua.c:(.text+0x167): undefined reference to `pjsua_call_get_info'
simple_pjsua.c:(.text+0x184): undefined reference to `pjsua_conf_connect'
simple_pjsua.c:(.text+0x196): undefined reference to `pjsua_conf_connect'
/tmp/ccxmvFQD.o: In function `error_exit':
simple_pjsua.c:(.text+0x1d0): undefined reference to `pjsua_perror'
simple_pjsua.c:(.text+0x1d5): undefined reference to `pjsua_destroy'
/tmp/ccxmvFQD.o: In function `main':
simple_pjsua.c:(.text+0x20b): undefined reference to `pjsua_create'
simple_pjsua.c:(.text+0x24b): undefined reference to `pjsua_verify_url'
simple_pjsua.c:(.text+0x27b): undefined reference to `pjsua_config_default'
simple_pjsua.c:(.text+0x2ab): undefined reference to `pjsua_logging_config_default'
simple_pjsua.c:(.text+0x2d3): undefined reference to `pjsua_init'
simple_pjsua.c:(.text+0x303): undefined reference to `pjsua_transport_config_default'
simple_pjsua.c:(.text+0x326): undefined reference to `pjsua_transport_create'
simple_pjsua.c:(.text+0x34c): undefined reference to `pjsua_start'
simple_pjsua.c:(.text+0x37c): undefined reference to `pjsua_acc_config_default'
simple_pjsua.c:(.text+0x386): undefined reference to `pj_str'
simple_pjsua.c:(.text+0x39e): undefined reference to `pj_str'
simple_pjsua.c:(.text+0x3c0): undefined reference to `pj_str'
simple_pjsua.c:(.text+0x3d8): undefined reference to `pj_str'
simple_pjsua.c:(.text+0x3f0): undefined reference to `pj_str'
/tmp/ccxmvFQD.o:simple_pjsua.c:(.text+0x412): more undefined references to `pj_str' follow
/tmp/ccxmvFQD.o: In function `main':
simple_pjsua.c:(.text+0x43b): undefined reference to `pjsua_acc_add'
simple_pjsua.c:(.text+0x47b): undefined reference to `pj_str'
simple_pjsua.c:(.text+0x4b3): undefined reference to `pjsua_call_make_call'
simple_pjsua.c:(.text+0x51c): undefined reference to `pjsua_call_hangup_all'
simple_pjsua.c:(.text+0x524): undefined reference to `pjsua_destroy'
collect2: error: ld returned 1 exit status
<builtin>: recipe for target 'simple_pjsua' failed
make: *** [simple_pjsua] Error 1

当然我做了$ ./configure && make dep && make && make install。如果我搜索libpjproject lib,我可以在这里找到它:

/usr$ find -iname "*libpjproject*"
./local/lib/pkgconfig/libpjproject.pc


感谢您的帮助!

1 个答案:

答案 0 :(得分:2)

发现错误..我在Makefile中犯了一个错误 不工作:

# If your application is in a file named myapp.cpp or myapp.c
# this is the line you will need to build the binary.
all: simple_pjsua

myapp : simple_pjsua.c
    $(CC) -o $@ $< `pkg-config --cflags --libs libpjproject`

clean:
    rm -f simple_pjsua.o simple_pjsua

工作:

# If your application is in a file named myapp.cpp or myapp.c
# this is the line you will need to build the binary.
all: simple_pjsua

simple_pjsua: simple_pjsua.c
    $(CC) -o $@ $< `pkg-config --cflags --libs libpjproject`

clean:
    rm -f simple_pjsua.o simple_pjsua

我忘记将myapp : simple_pjsua.c更改为simple_pjsua: simple_pjsua.c

相关问题