Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2001-06-12 09:54:11


On Tuesday 12 June 2001 07:47, you wrote:
> I am having some problems with boost::function, from the documentation
> I suppose this should work:
>
> #include <iostream>
>
> // I have moved some include files slightly
> #include "function.hpp"
>
>
> void foo()
> {
> std::cout << "Hello!" << std::endl;
> }
>
>
> int main()
> {
> boost::function<void> f;
> f = &foo;
> f();
> }
>
>
> However with gcc 2.96 I get these errors:

Ah, the infamous GCC 2.96 :)

It appears that the compiler is doing partial ordering of function templates
incorrectly (2.95.x also had this problem), so you'll need to define
BOOST_WEAK_FUNCTION_TEMPLATE_ORDERING.

You can either:
        1) add -DBOOST_WEAK_FUNCTION_TEMPLATE_ORDERING to the command line when
compiling, or,
        2) modify boost/detail/function_base.hpp: where the test is done for GCC
2.95.x, (if __GNUC__ == 2 && __GNUC_MINOR__ <= 95), change the 95 to 96.

[error message snipped]

        Doug


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk