lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] LwIP issue: "undefined reference".


From: Paul Archer
Subject: Re: [lwip-users] LwIP issue: "undefined reference".
Date: Mon, 17 Jan 2011 12:02:05 +1100

lwIP needs to be compiled with the file client.c

You either need to build a lwIP as a static library and link with it.

Or you need to make a Makefile that will build both your client.c and
lwIP together.

Are you sure that you need to use lwIP? Are you using an embedded
system or are you trying to do socket programming?

Regards Paul

On Sat, Jan 15, 2011 at 7:01 AM, DaMunky89 <address@hidden> wrote:
>
> 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 believe I've included all the requisite files!
> http://old.nabble.com/file/p30674968/files.png
>
> I'm using "lwip-win32-msvc-0.1", which is based on the CVS version of lwIP
> from 23-01-2002. It is available for download here:
> http://ishare.iask.sina.com.cn/f/5245596.html
>
> The computer I am attempting to compile on is a Sony VPCF126FM, with no
> hardware modifications of any kind:
> www.docs.sony.com/release/specs/VPCF126FMB_mksp.pdf
>
> 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.
> --
> View this message in context: 
> http://old.nabble.com/LwIP-issue%3A-%22undefined-reference%22.-tp30674968p30674968.html
> Sent from the lwip-users mailing list archive at Nabble.com.
>
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/lwip-users
>



-- 
----
Regards
Paul Archer
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]