linking boost c++ library

845 views
Skip to first unread message

Kemal Deniz Teket

unread,
Jan 27, 2012, 7:05:36 AM1/27/12
to ns-3-users
Hi all,

I need to link an external library (boost) to ns3. I searched on web
but i couldn't find any precise explanation. Can anyone suggest me any
source?

Thanks

Tommaso Pecorella

unread,
Feb 1, 2012, 6:40:30 PM2/1/12
to ns-3-users
Hi,

ns-3 already uses boost in some places. If I do remember well, in the
flow monitor module. Check there for hints.

Cheers,

T.

crazy_bird

unread,
Jul 17, 2012, 1:02:38 PM7/17/12
to ns-3-...@googlegroups.com
need help. I include the boost head file, but I had the link errors like this:
Undefined symbols for architecture x86_64:
  "boost::system::system_category()", referenced from:
      __static_initialization_and_destruction_0(int, int)in ipv4-nix-vector-routing.cc.1.o
      boost::thread_exception::thread_exception(int, char const*)in ipv4-nix-vector-routing.cc.1.o
  "boost::system::generic_category()", referenced from:
      __static_initialization_and_destruction_0(int, int)in ipv4-nix-vector-routing.cc.1.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status

thanks.

在 2012年2月2日星期四UTC+8上午7时40分30秒,Tommaso Pecorella写道:

crazy_bird

unread,
Jul 17, 2012, 1:18:44 PM7/17/12
to ns-3-...@googlegroups.com
Is there any suggestions?

在 2012年7月18日星期三UTC+8上午1时02分38秒,crazy_bird写道:

Konstantinos

unread,
Jul 17, 2012, 3:42:33 PM7/17/12
to ns-3-...@googlegroups.com
Hi,

It's not enough to add the header.

You have to link the libraries using the waf script

See this thread for more information https://groups.google.com/forum/?fromgroups#!topic/ns-3-users/h4VGu4-x_ps

crazy_bird

unread,
Jul 18, 2012, 12:32:55 AM7/18/12
to ns-3-...@googlegroups.com
Hi,thanks for your reply. I am not familiar with the waf build system. I have tried by followed by the thread, but still do not work.
The build errors:
Undefined symbols for architecture x86_64:
  "boost::system::system_category()", referenced from:
      __static_initialization_and_destruction_0(int, int)in ipv4-nix-vector-routing.cc.2.o
      boost::thread_exception::thread_exception(int, char const*)in ipv4-nix-vector-routing.cc.2.o
  "boost::system::generic_category()", referenced from:
      __static_initialization_and_destruction_0(int, int)in ipv4-nix-vector-routing.cc.2.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status

在 2012年7月18日星期三UTC+8上午3时42分33秒,Konstantinos写道:

crazy_bird

unread,
Jul 18, 2012, 1:33:17 AM7/18/12
to ns-3-...@googlegroups.com
I want to use the boost library in Nix-vecotr-routing model.
I have modified the wscript in Nix-vector-routing model.
def build(bld)
obj=bld.create(...)
obj.env.append_value('LIBPATH','/Users/jluo/Downloads/boost_1_50_0/stage/lib')
obj.includes='/Users/jluo/Downloads/boost_1_50_0'
obj.lib=['boost']
obj.libpath=['/Users/jluo/Downloads/boost_1_50_0/stage/lib']

But when I run ./waf , it still give the message "ld: library not found for -lboost"
should I need to change the wscript in the top level? And how?
Reply all
Reply to author
Forward
0 new messages