[libnice] Trick about using the libnice library...

Jack Wang antirazin at gmail.com
Mon Sep 14 19:09:38 PDT 2015


Hi,


Recently I'd like to modify the source code of libnice to new a function,
however, I found something strange like the followings:

I wrote a new function (called "myfunc" here),
Then when I used the libnice library (.so) in another.c file (called
"test.c" herer)  and calld myfunc() ,
compiling on test.c failed and showed that

undefined reference to `myfunc'

but I'm pretty sure the .so file is put on the proper path and the related
header is included.
If I remove the change I did, the compiling works.
If I just add some additional printf() in libnice, it does apply the
modified part without compiling error.


Actually,

I fixed it. But I don't know why :/

The solution is I configured libnice with --enable-static and it generated
the static library (.a),
I linked the .a file instead of .so file to test.c, the compiling works if
I called the myfunc().


Anyone find the point??
If I don't say clearly , please let me know.


Thanks in advance. :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/nice/attachments/20150915/e6b2e54e/attachment.html>


More information about the nice mailing list