What library to add to makefile for for rand() and memset()

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
BoCo_1857246
Level 4
Level 4
10 replies posted 5 replies posted 10 questions asked

I wish to make calls to rand() and memset() , both of which are in the WICED header files. I get linker errors that they're undefined. Presumably I need to add a library (or two) to my makefile for my BCM20736S.

How should the makefile be modified to link in rand() and memset() ?

0 Likes
1 Solution
MudeL_51
Employee
Employee
10 replies posted 5 replies posted First solution authored

1. memset()

     Please refer to the file "hello_sensor.c (WICED-Smart-SDK\Apps\hello_sensor)".

     You only need to include the header file "spar_utils.h".

2. rand()

     You can include the library by adding the below codes in your application's makefile:

                    LIBS += [LIB PATH]

     Ex. If you want to use function rand() in "hello_sensor" application, you can add below codes in "makefile.mk (WICED-Smart-SDK\Apps\hello_sensor)"

     ...

     LIBS += ../../Tools/ARM_GNU/lib/libc.a

View solution in original post

0 Likes
2 Replies
MudeL_51
Employee
Employee
10 replies posted 5 replies posted First solution authored

1. memset()

     Please refer to the file "hello_sensor.c (WICED-Smart-SDK\Apps\hello_sensor)".

     You only need to include the header file "spar_utils.h".

2. rand()

     You can include the library by adding the below codes in your application's makefile:

                    LIBS += [LIB PATH]

     Ex. If you want to use function rand() in "hello_sensor" application, you can add below codes in "makefile.mk (WICED-Smart-SDK\Apps\hello_sensor)"

     ...

     LIBS += ../../Tools/ARM_GNU/lib/libc.a

0 Likes

Thank you very much, that solved my problem.

0 Likes