This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

gcc-3.0 pre and mem_fun()


Hi,

I tested some code from alt.comp.lang.learn.c-c++
It compiles and works with gcc-2.95.4.

It also compiles with gcc-3.0pre(cvs-version from yesterday)
but it does not execute.

the error is:

./memfun: error while loading shared libraries: ./memfun: 
          symbol __register_frame_info_bases, version GCC_3.0 not defined
          in file libgcc_s.so.0 with link time reference

So perhaps this is the wrong place and the problem is within the compiler.

O.K the code:

//////////////////////////////////////////////////////////////////

#include <iostream>
#include <functional>
#include <algorithm>
#include <list>

using namespace std;

class Base {
public:
 virtual void set() { cout << "Base::set()" << endl; }
};

class Derived : public Base {
public:
 virtual void set() { cout << "Derived::set()" << endl; }
};

int main()
{
 Base* b = new Base;
 Derived* d = new Derived;

 list<Base*> lst;
 lst.push_back(b);
 lst.push_back(d);

 for_each(lst.begin(), lst.end(), mem_fun(&Base::set));
}

/////////////////////////////////////////////////////////////////////////

bye, Ralf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]