Mail Archives: djgpp/1998/05/02/14:04:36
mimo wrote:
>
> Error: test.o: In function `__tcf_0':
> Error: test.cc(.text+0x1f): undefined reference to
> `String::~String(void)'
> Error: test.o: In function `main':
> Error: test.cc(.text+0x49): undefined reference to
> `String::String(char const *)'
> test.cc(2) Error: undefined reference to `operator<<(ostream &, String
> const &)'
That's very interesting. No matter what I did, I was unable to
reproduce your exact results, although I saw plenty of slightly
different errors. Perhaps it's because I'm using gcc 2.8.0 and you're
still using 2.7.2.1. In any case, the solution is simple: you must
link all required C++ libraries when you compile. To use the String
class, you have to link with both -lstdcxx and -lgpp.
You have two other problems in your code: in order to use cout, you
should #include <iostream.h> (even though it is included already by
<_string.h>), and void is not a legal return type for main().
--
John M. Aldrich, aka Fighteer I <fighteer AT cs DOT com> UIN# 7406319
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS d- s+:- a-->? C++>$ U@>++$ p>+ L>++ E>++ W++ N++ o+>++ K? w(---)
O- M-- V? PS+ PE Y+ PGP- t+(-) 5- X- R+(++) tv+() b+++ DI++ D++ G>++
e(*)>++++ h!() !r !y+()
------END GEEK CODE BLOCK------
- Raw text -