FPGA Intellectual Property
PCI Express*, Networking and Connectivity, Memory Interfaces, DSP IP, and Video IP
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
5886 Discussions

LwIP issue: "undefined reference".

Honored Contributor II

Hi, I'm working on a project for school that will be using lwIP, and I need to familiarize myself with how it works. For now I'm just trying to write a simple test program. It doesn't even do anything yet, but I cannot for the life of me get it to compile: 

#include "lwip\udp.h" void udp_packet_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16_t port); main(){ // Create a new pcb. struct udp_pcb * pcb; pcb = udp_new(); if (pcb == NULL) return -1; // Bind to any IP on port 60,000. if (udp_bind(pcb, IP_ADDR_ANY, 60000) != ERR_OK) return -2; // On datagram receipt, call udp_packet_recv. udp_recv(pcb, udp_packet_recv, NULL); } void udp_packet_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16_t port){ if (p != NULL){ // TODO: Case handling GET packet. // TODO: Case handling data receipt. pbuf_free(p); // Free pbuf when finished. } } Every time I try to compile this, I get the following errors: 

C:\Users\ZACHAR~1\AppData\Local\Temp\cc1kZ7BP.o:client.c:(.text+0xf): undefined reference to `udp_new()' C:\Users\ZACHAR~1\AppData\Local\Temp\cc1kZ7BP.o:client.c:(.text+0x3d): undefined reference to `udp_bind(udp_pcb*, ip_addr*, unsigned short)' C:\Users\ZACHAR~1\AppData\Local\Temp\cc1kZ7BP.o:client.c:(.text+0x5d): undefined reference to `udp_packet_recv(void*, udp_pcb*, pbuf*, ip_addr*, unsigned short)' C:\Users\ZACHAR~1\AppData\Local\Temp\cc1kZ7BP.o:client.c:(.text+0x69): undefined reference to `udp_recv(udp_pcb*, void (*)(void*, udp_pcb*, pbuf*, ip_addr*, unsigned short), void*)' C:\Users\ZACHAR~1\AppData\Local\Temp\cc1kZ7BP.o:client.c:(.text+0x8e): undefined reference to `pbuf_free(pbuf*)' collect2: ld returned 1 exit status I read something online about linking "lwip4", but have not been able to find anything about that file elsewhere. (I can't even figure out where I originally read that...) 




I'm using "lwip-win32-msvc-0.1", which is based on the CVS version of lwIP from 23-01-2002. 


The computer I am attempting to compile on is a Sony VPCF126FM, with no hardware modifications of any kind. 


I'm using MiniGW command line " g++ client.c -o client.exe" to compile. (Nothing fancy.) 

Can anybody help me out here? This has become a real sticking point.
0 Kudos
1 Reply
Honored Contributor II

I managed to find "lwip4.dsp" and "lwip4.dsw" in the "lwip-win32-msvc-0.1\proj\msvc6" directory. I'm not sure these are the right files though, and attempting to link them with the following commands has not worked. 


-llwip4.dsp -llwip4.dsw -l lwip4.dsp -l lwip4.dsw -llwip4 -l lwip4 


I keep getting some variation of "ld.exe: cannot find -llwip4".