gvanem / Watt-32

Watt-32 TCP/IP library and samples.
https://www.watt-32.net/
18 stars 8 forks source link

Undefined reference to poll() #77

Closed jwt27 closed 1 year ago

jwt27 commented 1 year ago

Hi,

Just ran into this strange error:

#include <stddef.h>
#include <poll.h>

int main()
{
    return poll(NULL, 0, 0);
}

Compiled as C++:

$ i386-pc-msdosdjgpp-g++ test.c -lwatt
/usr/lib/gcc/i386-pc-msdosdjgpp/12.2.0/../../../../i386-pc-msdosdjgpp/bin/ld: /tmp/ccwlbj7Q.o:test.c:(.text+0x1b): undefined reference to `poll(pollfd*, int, int)'
collect2: error: ld returned 1 exit status

But it links correctly when compiled as C.

jwt27 commented 1 year ago

Ah, poll() should be declared extern "C", of course. PR incoming...