Socket example is not compiling because of undefined reference to inet_addr

Hello,

I am trying to run a TCP socket in a circuitdojo feather nrf9160 board but it is not compiling and gives the error "undefined reference to `inet_addr'"

I added the headers as per other examples

#if !defined(CONFIG_NET_SOCKETS_POSIX_NAMES)
#include <zephyr/posix/unistd.h>
#include <zephyr/posix/netdb.h>
#include <zephyr/posix/sys/time.h>
#include <zephyr/posix/sys/socket.h>
#include <zephyr/posix/arpa/inet.h>
#else
#include <zephyr/net/socket.h>
#endif

server_addr.sin_addr.s_addr = inet_addr("17x.x.x.x");

The command to build:

west build -b circuitdojo_feather_nrf9160_ns

Related