|
Boost : |
Subject: Re: [boost] Problem with using matrix library with unit test library
From: Raffi Enficiaud (raffi.enficiaud_at_[hidden])
Date: 2017-03-21 12:38:26
Le 20/03/2017 à 17:50, SHIVAM MITTAL via Boost a écrit :
> Hi everyone,
> I have been developing something, and basically it requires the two boost
> libraries - the matrix library and unit test library.
>
> I have a file test.cpp :
>
> #include <boost/numeric/ublas/matrix.hpp>
> #include <boost/numeric/ublas/io.hpp>
> #include <boost/test/included/unit_test.hpp>
>
> #define BOOST_TEST_DYN_LINK
> #define BOOST_TEST_MODULE test
>
> BOOST_AUTO_TEST_SUITE(Integer_matrices)
>
> BOOST_AUTO_TEST_CASE(Constructors)
> {
> BOOST_CHECK(2 == 2);
> }
>
> BOOST_AUTO_TEST_SUITE_END()
>
>
> I am compiling this with:
> g++ -I <path to boost_1_63_0> test.cpp
>
>
> I'm getting the following error:
> /tmp/ccnxRzsf.o: In function `main':
> test.cpp:(.text+0x18aa1): undefined reference to `init_unit_test_suite(int,
> char**)'
> collect2: error: ld returned 1 exit status
>
> Any help will be greatly appreciated.
> Thanks.
Just remove the "#define BOOST_TEST_DYN_LINK": you are forcing the
dynamic link while at the same time you are using the "included" variant
(header only).
See
http://www.boost.org/doc/libs/1_63_0/libs/test/doc/html/boost_test/usage_variants.html
for more details.
Raffi
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk