Boost logo

Boost Users :

Subject: Re: [Boost-users] undefined reference to member function in AUTO_TEST_CASE
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-06-17 11:04:27


AMDG

Moritz Beber wrote:
> On 17/06/10 16:49, Steven Watanabe wrote:
>> Moritz Beber wrote:
>>> I have a peculiar problem when compiling my unit tests. The reason
>>> why I find it peculiar is that I can compile the same code in a
>>> normal function just fine. Here is what I have in a main function:
>>>
>>> <snip>
>>> When I try to compile it I get the following errors:
>>>
>>> /tmp/ccOI5FiJ.o: In function
>>> `ParameterManagerTest::test_default_constructor::test_method()':
>>> test_rfn.cpp:(.text+0xcf): undefined reference to
>>> `rfn::ParameterManager::instance(rfn::FunctionalNetworkScheme)'
>>> test_rfn.cpp:(.text+0x136): undefined reference to
>>> `rfn::ParameterManager::instance()'
>>>
>>> I see no reason why the reference should be undefined as I include
>>> the class header and specify the path to the .cpp file. Does the
>>> unit test framework have a problem with static member functions?
>>
>> What command line did you use to build?
> g++ test_rfn.cpp -o test -I ../classes -I . -L /usr/local/lib -l
> boost_system -l boost_unit_test_framework -Wno-deprecated

You need to link to whatever object file has the definition of instance.

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net