undefined reference to `sntp_start_auto_time_sync'. It's the error when i include "sntp.h" in application.c. I don't understand about eclipse

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

cross mob
Anonymous
Not applicable

undefined reference to `sntp_start_auto_time_sync'. It's the error when i include "sntp.h" in application.c. I don't understand about eclipse

0 Likes
3 Replies
SeyhanA_31
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

Hi,

Perhaps you need to include libraries as well.

Include "$(NAME)_COMPONENTS +=protocols/SNTP" in the make file and add ' #include "sntp.h" ' to the source.

For sample code perhaps you can look at .../apps/snip/email sample application or Email State Changes Of Input (Push2Email) application sample codes.

Seyhan

0 Likes
SuMa_296631
Level 5
Level 5
50 replies posted 25 replies posted 10 replies posted

By including the "sntp.h" file, the system *assumes* that you will also be compiling the "sntp.c" and including that into your app.

Apart from the "ntp_timestamp_t" typedef, that .h file does nothing other than define 3 functions that either you must provide or you include with the "sntp.c" code.

I'm running in to a similar problem in that I want to use the SNTP capabilities of the NetX network from my own code (I want to read the time once and not every 'x' seconds) and finidng the right combination of includes and libraries etc. is (currently) a bit of a challenge (for me - still at the steep part of the learning curve).

Susan

0 Likes

Hi,

Copy the attached get_time_once directory to /app/snip directory.

Add following lines to .../libraries/protocols/SNTP/sntp.c

wiced_result_t sntp_get_time_once( void )

{

    /* Synchronise time with NTP server once */

    return ( sync_ntp_time( NULL ) );

}

Add following line to .../libraries/protocols/SNTP/sntp.h

wiced_result_t sntp_get_time_once( void );

Build and run the GetTimeOnce application.

     snip.get_time_once-<YourTargetPlatform> download run

   

     Eg:

         snip.get_time_once-BCM943362WCD4 download run

Hope it helps.

Seyhan

0 Likes