I am creating a command line C++ test application (executable) to be run on my rooted android device.
The executable uses multiple prebuilt C libraries, one of which use 'rand()'. During linking state i get the error "undefined reference of 'rand'"
To check if the paths are set properly, I have tried below approaches with no success.
First Approach: I define the rand() in my test source.
I notice that i get mutiple definition error, the first definition being in bionic/libc/include/stdlib.h
Second Approach: Used rand() in my test application
I notice that the linker does not complain about undefined symbol here
Third Approach: Unarchived and archived all the object files
Found that I still get the undefined reference error.
When the C library that uses 'rand' is compiled into an executable using C test file the mentioned linker error is not seen.
I cannot modify the prebuilt static libraries and need to use the library with my C++ based test application.
Any inputs will be very welcome.