2017-04-12 71 views
0

我試圖編譯以下this tutorial一個PJSIP例子,但我make後有那些錯誤:編譯PJSIP例如

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

發現錯誤..我在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 [email protected] $< `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 [email protected] $< `pkg-config --cflags --libs libpjproject` 

clean: 
    rm -f simple_pjsua.o simple_pjsua 

我忘了改myapp : simple_pjsua.csimple_pjsua: simple_pjsua.c