Mail Archives: djgpp/1996/11/06/17:31:16
Hi,
I am learning STL by trying the example at Musser's book.
I am using djgpp v2. The simple example (example 1-3, p19)
#include <iostream.h>
#include <algo.h>
#include <vector.h>
#include <assert.h>
vector<char> vec(char *s)
{
vector<char> x;
while(*s != '\0')
x.push_back(*s++);
return x;
}
int main()
{
cout << "Using reverse algorithm with a vector" << endl;
vector<char> vector1=vec("mark twain");
reverse(vector1.begin(), vector1.end());
assert(vector1 == vec("niawt kram"));
}
cause a error at link-time as follows,
undefined reference to 'operator new (unsigned long, void *)'
Anyone know how to fix this problem? Thanks a lot.
Kuang-chun Cheng
kccheng AT hep2 DOT phys DOT sinica DOT edu DOT tw
- Raw text -