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

From: e8426311 AT stud2 DOT tuwien DOT ac DOT at (Christian Mangold)
Newsgroups: comp.os.msdos.djgpp
Subject: STL-example - Linking problem
Date: Sun, 17 Nov 1996 16:53:32 GMT
Organization: Vienna University of Technology, Austria
Lines: 37
Message-ID: <328f421b.8751280@news.tuwien.ac.at>
NNTP-Posting-Host: edvtsma04.tuwien.ac.at
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi! given this example:

#include <typeinfo>
#include <stl.h>
#include <iostream.h>

int main ()
{
  vector <int> v (5);
  for (int i = 0; i < v.size (); i++)
    v[i] = i + 1;
  int sum = accumulate (v.begin (), v.end (), 0);
  cout << "sum = " << sum << endl;
  return 0;
}

compiles well with djgpp version 2.01 
(compiler-options: -frepo -frtti -c)

but when i try to link this i get the following:

gcc accum1.o -frepo -frtti -lgpp -o test
accum1.o: In function `main':
accum1.cc:14: undefined reference to `vector<int>::vector(unsigned
long, int const &)'
... 
...	much more undefined references 
...

I've tried to link with the -r option -> linking is ok but the
exe-result is not.

Any advice to get this example run would be very welcome.

thanks in advance, Christian.


- Raw text -


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