Re: Cannot find source of undefined identifier

From: Alf P. Steinbach (alfps_at_start.no)
Date: 03/30/04


Date: Tue, 30 Mar 2004 19:17:28 GMT


* "Dave" <better_cs_now@yahoo.com> schriebt:
> Below, I have included a greatly-stripped-down but complete example of a
> problem I am having. Specifically, my call to is_goal() (in the while loop)
> results in an "identifier is undefined" error. Can anybody out there see
> what the problem is? I'm stumped...
>
> Thanks,
> Dave
>
> #include <set>
> #include <vector>
>
> using namespace std;
>
> template <
> typename STATE_T,
> typename OP_T,
> typename GOAL_TEST_T
> >
> class search_engine_t: public GOAL_TEST_T
> {
> public:
> vector<OP_T> depth_limited(
> const STATE_T &initial_state,
> int limit
> )
> {
> STATE_T current_state(initial_state);
> vector<OP_T> rval;
>
> while (!is_goal(current_state))
> {
> }
>
> return rval;
> }
> };
>
> typedef int state_t;
> typedef int op_t;
>
> class goal_test_t
> {
> public:
> bool is_goal(const state_t &state)
> {
> return true;
> }
> };
>
> int main()
> {
> search_engine_t<
> state_t,
> op_t,
> goal_test_t
> > se;
>
> se.depth_limited(5, 5);
> }

It compiles fine with VC 7.1 but not with Comeau online.

With Comeau online I had to add a "using GOAL_TEST_T::is_goal;" in
there.

Don't know why that should be required or even why it works.

-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?


Relevant Pages

  • Re: another stupid c bug. (endless for loop)
    ... Skybuck Flying wrote: ... > to make a loop to test all possible values for a 16 bit word. ... Why is top-posting such a bad thing? ... What is the most annoying thing on usenet and in e-mail? ...
    (alt.comp.lang.borland-delphi)
  • Re: Appending a character to a field
    ... Why is top-posting such a bad thing? ... What is the most annoying thing on usenet and in e-mail? ... care of @df inside the while loop with % added back. ...
    (comp.lang.perl.misc)
  • Re: another stupid c bug. (endless for loop)
    ... Skybuck Flying wrote: ... > to make a loop to test all possible values for a 16 bit word. ... Why is top-posting such a bad thing? ... What is the most annoying thing on usenet and in e-mail? ...
    (comp.lang.c)
  • Re: list<class A*> l;
    ... First iterate through the list and delete each object. ... One way to do that is to use a 'for' loop. ... Why is top-posting such a bad thing? ... What is the most annoying thing on usenet and in e-mail? ...
    (comp.lang.cpp)
  • Re: Publishing my work
    ... Dave L. Renfro wrote: ... Well, as far as priority is concerned, it doesn't really ... make it look like a spam post. ... to find by googling usenet. ...
    (sci.math)