Author Message

<  bugs, errors  ~  Using Poco::Net::DatagramSocket in OF 006

PostPosted: Wed May 20, 2009 2:14 pm
Joined: Thu Oct 11, 2007 8:54 pmPosts: 20Location: Stockholm, Sweden
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?

/Fredrik


Offline Profile
PostPosted: Thu May 21, 2009 9:23 am
Site AdminJoined: Wed Apr 11, 2007 1:02 amPosts: 1192Location: barcelona
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


Offline Profile
PostPosted: Thu May 21, 2009 11:35 am
User avatarSite AdminJoined: Mon Feb 05, 2007 9:31 pmPosts: 1806Location: brooklyn
are you on windows, linux or mac?

take care!
zach


Offline Profile
PostPosted: Thu May 28, 2009 9:58 am
Joined: Thu Oct 11, 2007 8:54 pmPosts: 20Location: Stockholm, Sweden
zach wrote:
are you on windows, linux or mac?

take care!
zach


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'|

Any ideas?
/fredrik


Offline Profile
PostPosted: Thu May 28, 2009 10:26 am
Site AdminJoined: Thu Mar 01, 2007 10:03 pmPosts: 916Location: Amsterdam
yup!

add this to your other linker flags: -lIphlpapi
see this post: viewtopic.php?f=7&t=1840&p=9880&hilit=lIphlpapi#p9880

Its fixed in 0.061



_________________
http://www.theowatson.com
Offline Profile
PostPosted: Thu May 28, 2009 4:41 pm
Joined: Thu Oct 11, 2007 8:54 pmPosts: 20Location: Stockholm, Sweden
theo wrote:
yup!

add this to your other linker flags: -lIphlpapi
see this post: viewtopic.php?f=7&t=1840&p=9880&hilit=lIphlpapi#p9880

Its fixed in 0.061


alright! thanks guys, will try,
/ fredrik

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.

/ F


Offline Profile

Display posts from previous:  Sort by:

All times are UTC
Page 1 of 1
6 posts
Users browsing this forum: No registered users and 0 guests
Search for:
Post new topic  Reply to topic
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
cron