I am just trying to open a UDP socket (a Poco::Net::DatagramSocket) but I just can’t seem to get it to work. I keep getting “undefined reference” errors …
…
undefined reference to Poco::Timespan::SECONDS
…
undefined reference to `Poco::RefCountedObject::~RefCountedObject()
…
and a bunch of others. Something with linker options, perhaps? I get these errors on both Windows and Linux.
Q: Does anybody have a working OF example that opens a DatagramSocket - and if so, did you need to mess around with linker options and stuff?
normally this kind of error is just a matter of changing the order of the libraries in the linker options, try changing PocoNet and PocoFoundation order
[quote author=“zach”]are you on windows, linux or mac?
take care!
zach[/quote]
Right now I’m on windows, so it looks a little different than on Linux but similar errors.
So on Windows, that would be under Project > Build Options > Linker settings.
I moved them around like this
…/…/…/libs/poco/libs/libPocoNetmt.a
…/…/…/libs/poco/libs/libPocoFoundationmt.a
and most of the errors did go away! Now I’m getting these two, though:
…\libs\poco\libs\libPocoFoundationmt.a(Environment.o):Environment.cpp:(.text+0x10ff)||undefined reference to `_GetAdaptersInfo@8’|
…\libs\poco\libs\libPocoFoundationmt.a(Environment.o):Environment.cpp:(.text+0x1233)||undefined reference to `_GetAdaptersInfo@8’|
Update: I did try. Not only did this solve my second problem, but it seems it fixed the first one too.
To further help somebody, maybe we could say that the fix is applied under
project > build options > linker settings > other linker options
Also you may need to select all builds (rather than just “release” or “debug” builds) by clicking on the project name in the tree view on the left of the “build options” window.
And then just add -liphlpapi to the bottom of the list.