Boost logo

Boost Users :

Subject: Re: [Boost-users] A linking error on switch_statement. Can anyone with kindness help me?
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-07-14 12:45:18


AMDG

fmingu wrote:
> I am using Dev-C++ with boost 1.34.1,the program is the following:
> .......................
> typedef std::map<int, int> IIPrimemap;
> IIPrimemap primemapvec;
> # define BetaKGre2 1
> # define EqualToOne 2
> #define ProductOfKPrime 3
> .........................
> (switch_statement(_1,
> case_statement<BetaKGre2>
> (var(result)=0),
> case_statement<EqualToOne>
> (var(result)=1),
> case_statement<ProductOfKPrime>
> (var(result)=bind(static_cast<long double (*)(long double,int)>(std::pow),
> constant(-1.0),bind(&IIPrimemap::size,var(primemapvec)))),
> default_statement
> ( var(result)=234)
> ))(switchvalue);
>
> the complier told me no errors.But the linker told me that:
> nstantiated from `Arg::sig<boost::tuples::tuple<A&, B&, C&, Env&, boost::tuples::null_type, boost::tuples::null_type, boost.........
> instantiated from `RET boost::lambda::lambda_functor_base<boost::lambda::s................
> nstantiated from `T::sig<boost::tuples::tuple<A&, boost::tuples::null_type, boost::tuples::null_type, bo...........
> instantiated from here..........// indicating the line:
> ))(switchvalue);
> And after the second compling and linking , the program passed and ran.
> I do not know why. And this was caused after I added the line:
> (var(result)=bind(static_cast<long double (*)(long double,int)>(std::pow),
> constant(-1.0),bind(&IIPrimemap::size,var(primemapvec)))),
> otherwise the program do not have such problems. How can I solve it?
>

1) This is a compiler error, not a linker error. The only way that
you can get an error like this from the linker is if the linker
is actually doing some of the work that would normally be done
by the compiler.
2) It helps if you can provide minimal and complete code
(i.e. something I can paste into a file and compile immediately)
3) Posting the noise in the compiler's error message while
snipping the useful information is not helpful.
4) If I understand you correctly, this is an irreproducible environment
problem, so there is basically nothing I can do to help.

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