Linking Boost Libraries

Hi,

I am trying to measure the execution time of a for loop in a block and
am
trying to use boost::chrono class to do it. However, when I build the
block I get:

Scanning dependencies of target gnuradio-modtest
[ 5%] Building CXX object
lib/CMakeFiles/gnuradio-modtest.dir/passthrough_impl.cc.o
Linking CXX shared library libgnuradio-modtest.dylib
Undefined symbols for architecture x86_64:
“boost::chrono::steady_clock::now()”, referenced from:
virtual thunk to gr::modtest::passthrough_impl::work(int,
std::vector<void const*, std::allocator<void const*> >&,
std::vector<void*,
std::allocator<void*> >&)in passthrough_impl.cc.o
gr::modtest::passthrough_impl::work(int, std::vector<void const*,
std::allocator<void const*> >&, std::vector<void*, std::allocator<void*>

&)in passthrough_impl.cc.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[2]: *** [lib/libgnuradio-modtest.dylib] Error 1
make[1]: *** [lib/CMakeFiles/gnuradio-modtest.dir/all] Error 2
make: *** [all] Error 2

I am assuming it is because I need to tell cmake to link against
libboost_chrono? In my CMakeCache.txt, the boost library paths are set
to
the correct locations:

//Path to a file.
Boost_INCLUDE_DIR:PATH=/opt/local/include

//Boost library directory
Boost_LIBRARY_DIRS:FILEPATH=/opt/local/lib

How do I tell cmake to link against libbboost_chrono?

Tahnks,
Jeff

On 01/25/2013 05:12 PM, Jeffrey Grasty wrote:

Undefined symbols for architecture x86_64:
make[1]: *** [lib/CMakeFiles/gnuradio-modtest.dir/all] Error 2
Boost_LIBRARY_DIRS:FILEPATH=/opt/local/lib

How do I tell cmake to link against libbboost_chrono?

Look for the find_package(Boost… line. There is a list of required
libraries, you should add chrono to this list.

-josh

Hi Josh,

Thanks! That worked.

Jeff

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs