undefined reference to `nice_address_is_linklocal'
I wrote a very simple demo to test whether 'nice_address_is_linklocal' works properly, but it cannot even compile successfully.
I just add an item into examples array in example/meson.build, no other compilation flags added.
Compiler use gcc11, OS: Ubuntu22.04, but it also occurs on Windows.
I can use the nm tool to find that the symbol does exist, but I don't know why there are still compilation errors.
Here is the example code:
#include <nice.h>
#include <stdio.h>
int main(){
NiceAddress address;
printf("%d", nice_address_is_linklocal(&address));
return 0;
}
Here is the compilation message:
[2/2] Linking target examples/nice-demo
FAILED: examples/nice-demo
cc -o examples/nice-demo examples/nice-demo.p/nice-demo.c.o -Wl,--as-needed -Wl,--no-undefined '-Wl,-rpath,$ORIGIN/../subprojects/glib-2.64.2/gio:$ORIGIN/../subprojects/zlib-1.2.11:$ORIGIN/../subprojects/glib-2.64.2/glib:$ORIGIN/../subprojects/glib-2.64.2/gobject:$ORIGIN/../subprojects/libffi/src:$ORIGIN/../subprojects/glib-2.64.2/gmodule:$ORIGIN/../nice:$ORIGIN/../subprojects/glib-2.64.2/gthread' -Wl,-rpath-link,/home/jpl/HestNetDeps/temp/libnice/dbuild/subprojects/glib-2.64.2/gio -Wl,-rpath-link,/home/jpl/HestNetDeps/temp/libnice/dbuild/subprojects/zlib-1.2.11 -Wl,-rpath-link,/home/jpl/HestNetDeps/temp/libnice/dbuild/subprojects/glib-2.64.2/glib -Wl,-rpath-link,/home/jpl/HestNetDeps/temp/libnice/dbuild/subprojects/glib-2.64.2/gobject -Wl,-rpath-link,/home/jpl/HestNetDeps/temp/libnice/dbuild/subprojects/libffi/src -Wl,-rpath-link,/home/jpl/HestNetDeps/temp/libnice/dbuild/subprojects/glib-2.64.2/gmodule -Wl,-rpath-link,/home/jpl/HestNetDeps/temp/libnice/dbuild/nice -Wl,-rpath-link,/home/jpl/HestNetDeps/temp/libnice/dbuild/subprojects/glib-2.64.2/gthread -Wl,--start-group subprojects/glib-2.64.2/gio/libgio-2.0.so.0.6400.2 subprojects/glib-2.64.2/gmodule/libgmodule-2.0.so.0.6400.2 subprojects/glib-2.64.2/glib/libglib-2.0.so.0.6400.2 subprojects/glib-2.64.2/gobject/libgobject-2.0.so.0.6400.2 nice/libnice.so.10.13.1 subprojects/glib-2.64.2/gthread/libgthread-2.0.so.0.6400.2 -pthread /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib/x86_64-linux-gnu/libcrypto.so -Wl,--end-group
/usr/bin/ld: examples/nice-demo.p/nice-demo.c.o: in function `main':
/home/jpl/HestNetDeps/temp/libnice/dbuild/../examples/nice-demo.c:7: undefined reference to `nice_address_is_linklocal'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.