This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

I need help with compiling/linking c++ programs under gcc 3.0.4 [UW/EE Research Computing #51]


Hi.  I don't know C++ so I ma having a little trouble diagnosing a
linking problem with gcc 3.0.4 which I just installed on a Redhat 7.1
machine.

jeffs@kittitas /tmp/gcc-3.0.4 572 $ >>./config.guess
i686-pc-linux-gnu


jeffs@kittitas /tmp/gcc-3.0.4 574 $ >>gcc -v
Reading specs from /usr/nikola/bin/../lib/gcc-lib/i686-pc-linux-gnu/3.0.1/specs
Configured with: ../gcc-3.0.1/configure --prefix=/usr/nikola/pkgs/gcc/.3.0.1
Thread model: single
gcc version 3.0.1
jeffs@kittitas /tmp/gcc-3.0.4 575 $ >>more /etc/issue

Red Hat Linux release 7.1 (Seawolf)
Kernel 2.4.9-12smp on a 2-processor i686

jeffs@kittitas /tmp/gcc-3.0.4 576 $ >>uname -a
Linux kittitas 2.4.9-12smp #1 SMP Tue Oct 30 18:16:48 EST 2001 i686 unknown
jeffs@kittitas /tmp/gcc-3.0.4 577 $ >>rpm -q glibc
glibc-2.2.4-19.3
jeffs@kittitas /tmp/gcc-3.0.4 578 $ >>
jeffs@kittitas /tmp/gcc-3.0.4 578 $ >>echo $LD_LIBRARY_PATH
/usr/nikola/lib:/usr/local/pkgs/gcc/lib
jeffs@kittitas /tmp/gcc-3.0.4 579 $ >>ls /usr/nikola/lib
crtxi.o            libcxa.a             libgcjgc.so.1.0.1  libMrm.so           libsupc++.la     libzgcj.a
crtxn.o            libcxa.so            libgcj.la          libMrm.so.2         libsvml.a        libzgcj.la
gcc-lib            libcxa.so.1          libgcj.so          libMrm.so.2.0.1     libtcl8.3.so     libzgcj.so
icrt.internal.map  libDtPrint.la        libgcj.so.2        libpdf.a            libtclstub8.3.a  libzgcj.so.0
icrt.link          libDtPrint.so        libgcj.so.2.0.0    libpdf.la           libtk8.3.so      libzgcj.so.0.0.0
libamanda.a        libDtPrint.so.1      libgcj.spec        libpdf.so           libtkstub8.3.a   nugget_header
libamanda.la       libDtPrint.so.1.0.0  libgrace_np.a      libpdf.so.1         libUil.la        tcl8.3
libamclient.a      libgcc_s.so          libguide.a         libpdf.so.1.1.1     libUil.so        tclConfig.sh
libamclient.la     libgcc_s.so.1        libguide.so        libstdc++.a         libUil.so.2      tk8.3
libamtape.a        libgcj.a             libiberty.a        libstdc++.la        libUil.so.2.0.1  tkConfig.sh
libamtape.la       libgcjgc.a           libimf.a           libstdc++.so        libXm.la         X11
libcprts.a         libgcjgc.la          libirc.a           libstdc++.so.3      libXm.so
libcprts.so        libgcjgc.so          libircmt.a         libstdc++.so.3.0.1  libXm.so.2
libcprts.so.1      libgcjgc.so.1        libMrm.la          libsupc++.a         libXm.so.2.0.1
jeffs@kittitas /tmp/gcc-3.0.4 580 $ >>ls /usr/local/pkgs/gcc/lib
gcc-lib        libgcjgc.a     libgcjgc.so.1.0.1  libgcj.so.2.0.0  libstdc++.la        libsupc++.a   libzgcj.so
libgcc_s.so    libgcjgc.la    libgcj.la          libgcj.spec      libstdc++.so        libsupc++.la  libzgcj.so.0
libgcc_s.so.1  libgcjgc.so    libgcj.so          libiberty.a      libstdc++.so.3      libzgcj.a     libzgcj.so.0.0.0
libgcj.a       libgcjgc.so.1  libgcj.so.2        libstdc++.a      libstdc++.so.3.0.4  libzgcj.la
jeffs@kittitas /tmp/gcc-3.0.4 581 $ >>

here is the problem program:

#include <fstream.h>
#include <iostream.h>

int main()
{
  cout<<"hello!"<<endl;
  return 0;
}

jeffs@kittitas /tmp/gcc-3.0.4 583 $ >>gcc ~jeffs/test.cc -o ~jeffs/test
/tmp/cco4OLGv.o: In function `main':
/tmp/cco4OLGv.o(.text+0x1a): undefined reference to `std::cout'
/tmp/cco4OLGv.o: In function `__static_initialization_and_destruction_0(int, int)':
/tmp/cco4OLGv.o(.text+0x5e): undefined reference to `std::ios_base::Init::Init()'
/tmp/cco4OLGv.o(.text+0xbc): undefined reference to `std::ios_base::Init::~Init()'
/tmp/cco4OLGv.o: In function `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)':
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc+0xfb): undefined reference to `__cxa_begin_catch'
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc+0x150): undefined reference to `__cxa_rethrow'
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc+0x15b): undefined reference to `__cxa_end_catch'
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc+0x165): undefined reference to `__cxa_end_catch'
/tmp/cco4OLGv.o: In function `std::ostream::operator<<(std::ostream& (*)(std::ostream&))':
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSolsEPFRSoS_E+0x59): undefined reference to `__cxa_begin_catch'
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSolsEPFRSoS_E+0xb2): undefined reference to `__cxa_rethrow'
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSolsEPFRSoS_E+0xbd): undefined reference to `__cxa_end_catch'
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSolsEPFRSoS_E+0xc7): undefined reference to `__cxa_end_catch'
/tmp/cco4OLGv.o: In function `std::ostream::sentry::~sentry()':
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSo6sentryD1Ev+0x3b): undefined reference to `std::uncaught_exception()'
/tmp/cco4OLGv.o: In function `std::_Format_cache<char>::_S_get(std::ios_base&)':
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSt13_Format_cacheIcE6_S_getERSt8ios_base+0x11): undefined reference to `std::ios_base::xalloc()'
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSt13_Format_cacheIcE6_S_getERSt8ios_base+0x4d): undefined reference to `operator new(unsigned)'
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSt13_Format_cacheIcE6_S_getERSt8ios_base+0x62): undefined reference to `std::_Format_cache<char>::_Format_cache()'
id*)'
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSt13_Format_cacheIcE6_S_getERSt8ios_base+0xbd): undefined reference to `operator delete(void*)'
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSt13_Format_cacheIcE6_S_getERSt8ios_base+0xd6): undefined reference to `std::ios_base::register_callback(void (*)(std::ios_base::event, std::ios_base&, int), int)'
/tmp/cco4OLGv.o: In function `std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)':
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate+0x6c): undefined reference to `std::__throw_ios_failure(char const*)'
/tmp/cco4OLGv.o: In function `std::auto_ptr<std::_Format_cache<char> >::~auto_ptr()':
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSt8auto_ptrISt13_Format_cacheIcEED1Ev+0x29): undefined reference to `operator delete(void*)'
/tmp/cco4OLGv.o: In function `std::_Format_cache<char>::_S_callback(std::ios_base::event, std::ios_base&, int)':
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSt13_Format_cacheIcE11_S_callbackENSt8ios_base5eventERS1_i+0x73): undefined reference to `operator delete(void*)'
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSt13_Format_cacheIcE11_S_callbackENSt8ios_base5eventERS1_i+0x94): undefined reference to `operator new(unsigned)'
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSt13_Format_cacheIcE11_S_callbackENSt8ios_base5eventERS1_i+0xa9): undefined reference to `std::_Format_cache<char>::_Format_cache()'
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSt13_Format_cacheIcE11_S_callbackENSt8ios_base5eventERS1_i+0xd6): undefined reference to `operator delete(void*)'
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSt13_Format_cacheIcE11_S_callbackENSt8ios_base5eventERS1_i+0xf2): undefined reference to `operator delete(void*)'
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSt13_Format_cacheIcE11_S_callbackENSt8ios_base5eventERS1_i+0x10a): undefined reference to `__cxa_begin_catch'
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSt13_Format_cacheIcE11_S_callbackENSt8ios_base5eventERS1_i+0x112): undefined reference to `__cxa_end_catch'
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSt13_Format_cacheIcE11_S_callbackENSt8ios_base5eventERS1_i+0x147): undefined reference to `__cxa_call_unexpected'
/tmp/cco4OLGv.o: In function `std::_Format_cache<char>::_M_populate(std::ios_base&)':
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSt13_Format_cacheIcE11_M_populateERSt8ios_base+0x1b4): undefined reference to `std::locale::~locale()'
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSt13_Format_cacheIcE11_M_populateERSt8ios_base+0x1d8): undefined reference to `std::locale::~locale()'
/tmp/cco4OLGv.o: In function `std::_Format_cache<char>::~_Format_cache()':
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSt13_Format_cacheIcED1Ev+0x5a): undefined reference to `__cxa_call_unexpected'
/tmp/cco4OLGv.o: In function `std::numpunct<char> const& std::use_facet<std::numpunct<char> >(std::locale const&)':
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZSt9use_facetISt8numpunctIcEERKT_RKSt6locale+0x51): undefined reference to `std::__throw_bad_cast()'
/tmp/cco4OLGv.o: In function `std::string::_Rep::_M_destroy(std::allocator<char> const&)':
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSs4_Rep10_M_destroyERKSaIcE+0x89): undefined reference to `__cxa_call_unexpected'
/tmp/cco4OLGv.o: In function `std::string::_Rep::_M_clone(std::allocator<char> const&, unsigned)':
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSs4_Rep8_M_cloneERKSaIcEj+0x60): undefined reference to `__cxa_begin_catch'
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSs4_Rep8_M_cloneERKSaIcEj+0x79): undefined reference to `__cxa_rethrow'
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSs4_Rep8_M_cloneERKSaIcEj+0x87): undefined reference to `__cxa_end_catch'
/tmp/cco4OLGv.o: In function `std::string::_Rep::_M_refcopy()':
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSs4_Rep10_M_refcopyEv+0x4a): undefined reference to `__cxa_call_unexpected'
/tmp/cco4OLGv.o: In function `std::string::_Rep::_S_create(unsigned, std::allocator<char> const&)':
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSs4_Rep9_S_createEjRKSaIcE+0x1b): undefined reference to `std::__throw_length_error(char const*)'
/tmp/cco4OLGv.o: In function `std::__malloc_alloc_template<0>::_S_oom_malloc(unsigned)':
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSt23__malloc_alloc_templateILi0EE13_S_oom_mallocEj+0x1f): undefined reference to `std::__throw_bad_alloc()'
/tmp/cco4OLGv.o(.gnu.linkonce.d._ZTISt9exception+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
/tmp/cco4OLGv.o: In function `std::ios_base::getloc() const':
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNKSt8ios_base6getlocEv+0x16): undefined reference to `std::locale::locale(std::locale const&)'
/tmp/cco4OLGv.o: In function `std::ios_base::pword(int)':
/tmp/cco4OLGv.o(.gnu.linkonce.t._ZNSt8ios_base5pwordEi+0x3a): undefined reference to `std::ios_base::_M_grow_words(int)'
/tmp/cco4OLGv.o: In function `__FRAME_BEGIN__':
/tmp/cco4OLGv.o(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
jeffs@kittitas /tmp/gcc-3.0.4 584 $ >>

Unfortunately, I don't know how to program in C++ so I don't really know how to go about dealing with this problem.  Can you help, please?

Many thanks,

Jeff

--
Jeff Silverman, sysadmin for the Research Computing Systems (RCS)
University of Washington, School of Engineering, Electrical Engineering Dept.
Box 352500, Seattle, WA, 98125-2500 FAX: (206) 221-5264 Phone (206) 221-5394
jeffs@rcs.ee.washington.edu     http://rcs.ee.washington.edu/~jeffs




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]