www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/06/17:31:16

From: kccheng AT hep2 DOT phys DOT sinica DOT edu DOT tw (Kuang-Chun Cheng)
Newsgroups: comp.os.msdos.djgpp
Subject: STL linker error
Date: 6 Nov 1996 21:23:33 GMT
Organization: Computing Center, Academia Sinica
Lines: 33
Message-ID: <55qvkl$akm@gate.sinica.edu.tw>
NNTP-Posting-Host: kccheng AT hep2 DOT phys DOT sinica DOT edu DOT tw
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019