undefined reference to `ostream::operator<<(char const *)'

This is a discussion about undefined reference to `ostream::operator<<(char const *)' in the Everything Linux category; Compiler: gcc-2. 91. 66 Simple program: lheed_a2ia. c Linked library: lheed. so (GCC: (GNU) egcs-2. 91. 66 19990314/Linux (egcs-1. 1. 2 release)) I have got errors in link: gmake all-recursive gmake: Entering directory `/home/lenja/lheed_a2ia' Making all in lheed_a2ia gmake: Entering directory `/home/lenja/lheed_a2 ...

Everything Linux 1800 This topic was started by , . Last reply by ,


data/avatar/default/avatar02.webp

4 Posts
Location -
Joined 2004-04-10
Compiler: gcc-2.91.66
Simple program: lheed_a2ia.c
Linked library: lheed.so (GCC: (GNU) egcs-2.91.66 19990314/Linux (egcs-1.1.2 release))
I have got errors in link:
 
gmake all-recursive
gmake[1]: Entering directory `/home/lenja/lheed_a2ia'
Making all in lheed_a2ia
gmake[2]: Entering directory `/home/lenja/lheed_a2ia/lheed_a2ia'
/bin/sh ../libtool --silent --mode=link --tag=CXX g++ -Wnon-virtual-dtor -Wno-long-long -Wundef -Wall
-pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align
-Wconversion -fno-builtin -g -O2 -O0 -g3 -Wall -fno-exceptions -fno-check-new -o lheed_a2ia lheed_a2ia.o
/home/lenja/checkreader/adsdb_8_2/lib/redhat61/libAdsDBApi.so
/home/lenja/checkreader/adsdb_8_2/lib/redhat61/libAdsDBApi.so: the use of `tmpnam' is dangerous, better use `mkstemp'
/home/lenja/checkreader/adsdb_8_2/lib/redhat61/libAdsDBApi.so: undefined reference to `cerr'
/home/lenja/checkreader/adsdb_8_2/lib/redhat61/libAdsDBApi.so: undefined reference to `__pure_virtual'
/home/lenja/checkreader/adsdb_8_2/lib/redhat61/libAdsDBApi.so: undefined reference to `__cp_push_exception'
/home/lenja/checkreader/adsdb_8_2/lib/redhat61/libAdsDBApi.so: undefined reference to `char type_info node'
/home/lenja/checkreader/adsdb_8_2/lib/redhat61/libAdsDBApi.so: undefined reference to `__ctype_b'
/home/lenja/checkreader/adsdb_8_2/lib/redhat61/libAdsDBApi.so: undefined reference to `endl(ostream &)'
/home/lenja/checkreader/adsdb_8_2/lib/redhat61/libAdsDBApi.so: undefined reference to `char type_info function'
/home/lenja/checkreader/adsdb_8_2/lib/redhat61/libAdsDBApi.so: undefined reference to `__uncatch_exception'
/home/lenja/checkreader/adsdb_8_2/lib/redhat61/libAdsDBApi.so: undefined reference to `__out_of_range(char const *)'
undefined reference to `ostream::operator<<(char const *)'
/home/lenja/checkreader/adsdb_8_2/lib/redhat61/libAdsDBApi.so: collect2: ld returned 1 exit status
gmake[2]: *** [lheed_a2ia] Error 1
gmake[2]: Leaving directory `/home/lenja/lheed_a2ia/lheed_a2ia'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/home/lenja/lheed_a2ia'
gmake: *** [all] Error 2
*** failed ***
 
What is the matter. Help me!
 
Leonid (pplenja@svs.mu)
 

Participate in our website and join the conversation

You already have an account on our website? To log in, use the link provided below.
Login
Create a new user account. Registration is free and takes only a few seconds.
Register
This subject has been archived. New comments and votes cannot be submitted.
Apr 10
Created
Apr 14
Last Response
0
Likes
2 minutes
Read Time
User User User
Users

Responses to this topic


data/avatar/default/avatar02.webp

4 Posts
Location -
Joined 2004-04-10
OP
Addition on:
 
I have tried to compile other way:
 
gcc -g -O2 -v -Q -Wall -o lheed /home/lenja/adsdb_8_2/lib/redhat61/lheed.so -I/home/lenja/adsdb_8_2/inc lheed_a2ia.c
 
but have got the same errors.
I havn't sources for lheed.so.
 
Thank you,
Lenja

data/avatar/default/avatar18.webp

2 Posts
Location -
Joined 2004-04-11
Well, you are trying to build C++ so you should replace gcc with g++. So, replace
$ gcc -g -O2 -v -Q -Wall -o lheed /home/lenja/adsdb_8_2/lib/redhat61/lheed.so -I/home/lenja/adsdb_8_2/inc lheed_a2ia.c
 
with:
$ g++ -g -O2 -v -Q -Wall -o lheed /home/lenja/adsdb_8_2/lib/redhat61/lheed.so -I/home/lenja/adsdb_8_2/inc lheed_a2ia.c
 
One other thing, you are running an ancient version of gcc (and what appears to be an ancient version of redhat), you should really consider upgrading to something more recent (and usable).
 
/ mindcooler

data/avatar/default/avatar02.webp

4 Posts
Location -
Joined 2004-04-10
OP
Thank you for advice but I have compiled program with g++ and have got the same errors.

data/avatar/default/avatar01.webp

120 Posts
Location -
Joined 2004-03-23
gidday there,
 
it looks to me as if you are missing some necessary headers or "#includes". Unfortunately I have completely diverted from C++-programming, but as far as I can remember ostream should be declared in either "ostream"/"ostream.h"/"ostream.hh" or "stdio.h". So my best guess would be to check the source-files if all included headers are in place and match the needed version of the compiler.
 
sorry that I can't spew out anything more specific

data/avatar/default/avatar18.webp

2 Posts
Location -
Joined 2004-04-11
Don't try to include the headers blackpage mentioned, they're all wrong. For std::cerr, std::endl etc you include <iostream> (no .h). But it seems to me that you are not just missing some includes, you seem to be missing to link c+++ as c++ code. If you want further help, post a complete, compilable, but smallest possible example that exhibits your problem.

data/avatar/default/avatar02.webp

4 Posts
Location -
Joined 2004-04-10
OP
Thank you for advice!
I will try.