Boost logo

Boost Users :

Subject: Re: [Boost-users] undefined reference to member function in AUTO_TEST_CASE
From: Moritz Beber (moritz.beber_at_[hidden])
Date: 2010-06-17 11:42:37


On 17/06/10 17:04, Steven Watanabe wrote:
> 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 mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
Silly me, forgot to add the class file. Thank you.
Best,
Moritz


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