GCC, C++, and broken linking

Bryce C plug-discuss@lists.plug.phoenix.az.us
08 Jan 2003 20:46:00 -0700


--=-38Eo4vGAja1D4k/1y3VS
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

c++ -DHAVE_CONFIG_H -I. -I. -I..     -Wall -Wimplicit -Wreturn-type
-Wunused -Wswitch -Wcomment -Wuninitialized -Wparentheses -Wtraditional
-Wpointer-arith -Wmissing-prototypes 	 -O1 	 -g -c main.cc
/bin/sh ../libtool --mode=3Dlink c++  -Wall -Wimplicit -Wreturn-type
-Wunused -Wswitch -Wcomment -Wuninitialized -Wparentheses -Wtraditional
-Wpointer-arith -Wmissing-prototypes 	 -O1 	 -g  -o ch  main.o =20
c++ -Wall -Wimplicit -Wreturn-type -Wunused -Wswitch -Wcomment
-Wuninitialized -Wparentheses -Wtraditional -Wpointer-arith
-Wmissing-prototypes -O1 -g -o ch main.o=20


I don't know how correct all that is but it's the relevant part of
make's.  This is from a project in Anjuta (http://anjuta.sf.net).

On Wed, 2003-01-08 at 20:30, Codie William Masters wrote:
> Somebody please explain what I'm doing wrong here. I'm trying to work
> on some of my Advanced Placement computer science AB projects here at
> home. Well, I typed in the code, checked it twice and ran 'gcc
> main.cpp' to no avail. First it gave me warnings about textspace
> standard so I fixed the code to make it recent (the book is 1994) and
> tried again. I now get all kinds of linker errors:
>=20
> /tmp/ccv7OZu3.o: In function `main':
> /tmp/ccv7OZu3.o(.text+0x36): undefined reference to
> `std::basic_ostream<char, std::char_traits<char> >& std::endl<char,
> std::char_traits<char> >(std::basic_ostream<char,
> std::char_traits<char> >&)'
> /tmp/ccv7OZu3.o(.text+0x43): undefined reference to `std::cout'
> /tmp/ccv7OZu3.o(.text+0x48): undefined reference to
> `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/ccv7OZu3.o(.text+0x51): undefined reference to
> `std::basic_ostream<char, std::char_traits<char>
> >::operator<<(std::basic_ostream<char, std::char_traits<char> >&
> (*)(std::basic_ostream<char, std::char_traits<char> >&))'
> /tmp/ccv7OZu3.o(.text+0x86): undefined reference to `std::cout'
> /tmp/ccv7OZu3.o(.text+0x8b): undefined reference to
> `std::basic_ostream<char, std::char_traits<char> >& std::operator<<
> <char, std::char_traits<char> >(std::basic_ostream<char,
> std::char_traits<char> >&, std::_Setw)'
> /tmp/ccv7OZu3.o(.text+0x94): undefined reference to
> `std::basic_ostream<char, std::char_traits<char> >::operator<<(int)'
> /tmp/ccv7OZu3.o(.text+0x10b): undefined reference to
> `std::basic_ostream<char, std::char_traits<char> >& std::endl<char,
> std::char_traits<char> >(std::basic_ostream<char,
> std::char_traits<char> >&)'
> /tmp/ccv7OZu3.o(.text+0x118): undefined reference to `std::cout'
> /tmp/ccv7OZu3.o(.text+0x11d): undefined reference to
> `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/ccv7OZu3.o(.text+0x126): undefined reference to
> `std::basic_ostream<char, std::char_traits<char>
> >::operator<<(std::basic_ostream<char, std::char_traits<char> >&
> (*)(std::basic_ostream<char, std::char_traits<char> >&))'
> /tmp/ccv7OZu3.o(.text+0x15b): undefined reference to `std::cout'
> /tmp/ccv7OZu3.o(.text+0x160): undefined reference to
> `std::basic_ostream<char, std::char_traits<char> >& std::operator<<
> <char, std::char_traits<char> >(std::basic_ostream<char,
> std::char_traits<char> >&, std::_Setw)'
> /tmp/ccv7OZu3.o(.text+0x169): undefined reference to
> `std::basic_ostream<char, std::char_traits<char> >::operator<<(int)'
> /tmp/ccv7OZu3.o(.text+0x17b): undefined reference to
> `std::basic_ostream<char, std::char_traits<char> >& std::endl<char,
> std::char_traits<char> >(std::basic_ostream<char,
> std::char_traits<char> >&)'
> /tmp/ccv7OZu3.o(.text+0x180): undefined reference to `std::cout'
> /tmp/ccv7OZu3.o(.text+0x185): undefined reference to
> `std::basic_ostream<char, std::char_traits<char>
> >::operator<<(std::basic_ostream<char, std::char_traits<char> >&
> (*)(std::basic_ostream<char, std::char_traits<char> >&))'
> /tmp/ccv7OZu3.o: In function
> `__static_initialization_and_destruction_0(int, int)':
> /tmp/ccv7OZu3.o(.text+0x1b6): undefined reference to
> `std::ios_base::Init::Init[in-charge]()'
> /tmp/ccv7OZu3.o: In function `__tcf_0':
> /tmp/ccv7OZu3.o(.text+0x1e5): undefined reference to
> `std::ios_base::Init::~Init [in-charge]()'
> /tmp/ccv7OZu3.o(.eh_frame+0x11): undefined reference to
> `__gxx_personality_v0'
> collect2: ld returned 1 exit status
>=20
> Does anyone know what I can do about this?
>=20
>=20
> -- Zach Schimke
--=20
Bryce C <Plug@BryceCo.Net>
CoBryce Communications


--=-38Eo4vGAja1D4k/1y3VS
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQA+HPB4/wbq/C6yyPcRAq9DAJ4lSSCZBC8Z+hSzQfdo8Gdnf9U1iACfS5T8
58U3w1krpUSlnrjofs5tDqE=
=Z8hH
-----END PGP SIGNATURE-----

--=-38Eo4vGAja1D4k/1y3VS--