SuperHouse / esp-open-rtos

Open source FreeRTOS-based ESP8266 software framework
BSD 3-Clause "New" or "Revised" License
1.53k stars 491 forks source link

How to link in sntp ? #537

Closed vortex314 closed 6 years ago

vortex314 commented 6 years ago

I'm trying to use the extras/sntp in the Makefile like this =>

PROGRAM=vertx-esp8266
EXTRA_COMPONENTS = extras/sntp ../Common  ../ArduinoJson  
PROGRAM_SRC_DIR=. 
PROGRAM_INC_DIR=. ../esp-open-rtos/include ../Common  ../ArduinoJson ../esp-open-rtos/lwip/lwip/src/include
ESPBAUD=921600
TTY ?= USB0
SERIAL_PORT ?= /dev/tty$(TTY)
ESPPORT = $(SERIAL_PORT)
SERIAL_BAUD = 921600
LIBS= m hal gcc 
PROGRAM_CFLAGS= -DESP8266_OPEN_RTOS 

include ../esp-open-rtos/common.mk

However I get an error on linking =>

./build/program.a(Sntp.o):(.text._ZN4Sntp3runEv+0x10): undefined reference to `sntp_set_update_delay(unsigned int)'
./build/program.a(Sntp.o):(.text._ZN4Sntp3runEv+0x14): undefined reference to `sntp_initialize(timezone const*)'
./build/program.a(Sntp.o):(.text._ZN4Sntp3runEv+0x18): undefined reference to `sntp_set_servers(char**, int)'
./build/program.a(Sntp.o): In function `Sntp::run()':

How do I link in correctly the build/sntp.a ?

vortex314 commented 6 years ago

Ok solved it =>

extern "C" {
#include <sntp.h>
}

Not so C++ friendly. ;-)