Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

I got a problem when write a ap program with lwip

when the build done I got error message as follow

it seems to be a linker problem

the TCPecho could be compile correctly

How could I do ? Thanks !!

obj/apps/TCPecho.o * In function `TCPecho': undefined reference to `netconn_new' lwip_web_server_1 line 0

obj/apps/TCPecho.o * undefined reference to `netbuf_data' undefined reference to `netconn_delete' lwip_web_server_1 line 0

obj/apps/TCPecho.o * undefined reference to `netconn_bind' undefined reference to `netconn_connect' lwip_web_server_1 line 0

obj/apps/TCPecho.o * undefined reference to `netconn_connect' undefined reference to `netconn_write' lwip_web_server_1 line 0

-------------------------

the TCPecho.c

# include "lwip/api.h"# include "lwip/ip_addr.h"# define LINELEN 128

void TCPecho(void){

struct netconn *conn;

struct netbuf *netbuf0;

char *data;

int len;

char buf[LINELEN+1]; /* buffer for one line of text */

int outchars, inchars; /* characters sent and received */

struct ip_addr ipaddr;

ipaddr.addr=htonl(0x0a000001);

conn=netconn_new(NETCONN_TCP);

netconn_bind(conn,&ipaddr,7);

netconn_connect(conn,&ipaddr,7);

while (fgets(buf, sizeof(buf), stdin)) {

buf[LINELEN] = '\0'; /* insure line null-terminated */

outchars = strlen(buf);

netconn_write(conn, buf, outchars,NETCONN_COPY);

/* read it back */

netbuf0=netconn_recv(conn);

if (netbuf0==NULL)

printf("write error/n");

netbuf_data(netbuf0,&data,&len);

fputs(data, stdout);

}//end of while

netconn_delete(conn);

}//end of TCPecho
No RepliesBe the first to reply