Linking Libcutils To Native Executable
I want my executable to be able to call functions supported by libcuils - like property_get(...). In the Android.mk I have: LOCAL_LDLIBS:=-lcutils ndk-build returns: undefined refe
Solution 1:
libcutils.so
is not part of official native API, it is not distributed with NDK. You can pull it from any device or even from emulator, and it is reasonable stable across the versions and mods, so I will not discourage you from using it.
On the other hand, the linker would normally say
ld: error: cannot find -lcutils
collect2: ld returned 1exitstatus
If it said undefined reference
, it probably found libcutils.so somewhere on its search path. Maybe, it was a wrong library. Maybe, you set LOCAL_LDLIBS
for a static library in your Android.mk, and therefore it is ignored.
LOCAL_LDLIBS
is only relevant for
include$(BUILD_SHARED_LIBRARY)
or
include$(BUILD_EXECUTABLE)
Post a Comment for "Linking Libcutils To Native Executable"