GCC, C++, and broken linking

Alan Dayley plug-discuss@lists.plug.phoenix.az.us
Thu, 9 Jan 2003 00:22:58 -0700 (GMT)


------=_Part_3_5619631.1042089611117
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

First, might I suggest that you ask these types of questions on the plug-devel list.  That is what it is for.

Second, it looks to me like you are not including a standard header file.  Maybe you missed putting it in at the top of your module.  Something like "#include <stdio.h>"

Third, it would be helpful to see the code or a part of it to know more of the full story.

I'll be watching the plug-devel list...

Alan

Original message attached.

------=_Part_3_5619631.1042089611117
Content-Type: TEXT/HTML; name=MESSAGE.HTML; charset=utf-8
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=MESSAGE.HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/1.1.7">
</HEAD>
<BODY>
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:<BR>
<BR>
/tmp/ccv7OZu3.o: In function `main':<BR>
/tmp/ccv7OZu3.o(.text+0x36): undefined reference to `std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; std::endl&lt;char, std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;)'<BR>
/tmp/ccv7OZu3.o(.text+0x43): undefined reference to `std::cout'<BR>
/tmp/ccv7OZu3.o(.text+0x48): undefined reference to `std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; std::operator&lt;&lt; &lt;std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, char const*)'<BR>
/tmp/ccv7OZu3.o(.text+0x51): undefined reference to `std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;::operator&lt;&lt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; (*)(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;))'<BR>
/tmp/ccv7OZu3.o(.text+0x86): undefined reference to `std::cout'<BR>
/tmp/ccv7OZu3.o(.text+0x8b): undefined reference to `std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; std::operator&lt;&lt; &lt;char, std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, std::_Setw)'<BR>
/tmp/ccv7OZu3.o(.text+0x94): undefined reference to `std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;::operator&lt;&lt;(int)'<BR>
/tmp/ccv7OZu3.o(.text+0x10b): undefined reference to `std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; std::endl&lt;char, std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;)'<BR>
/tmp/ccv7OZu3.o(.text+0x118): undefined reference to `std::cout'<BR>
/tmp/ccv7OZu3.o(.text+0x11d): undefined reference to `std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; std::operator&lt;&lt; &lt;std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, char const*)'<BR>
/tmp/ccv7OZu3.o(.text+0x126): undefined reference to `std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;::operator&lt;&lt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; (*)(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;))'<BR>
/tmp/ccv7OZu3.o(.text+0x15b): undefined reference to `std::cout'<BR>
/tmp/ccv7OZu3.o(.text+0x160): undefined reference to `std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; std::operator&lt;&lt; &lt;char, std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, std::_Setw)'<BR>
/tmp/ccv7OZu3.o(.text+0x169): undefined reference to `std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;::operator&lt;&lt;(int)'<BR>
/tmp/ccv7OZu3.o(.text+0x17b): undefined reference to `std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; std::endl&lt;char, std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;)'<BR>
/tmp/ccv7OZu3.o(.text+0x180): undefined reference to `std::cout'<BR>
/tmp/ccv7OZu3.o(.text+0x185): undefined reference to `std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;::operator&lt;&lt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; (*)(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;))'<BR>
/tmp/ccv7OZu3.o: In function `__static_initialization_and_destruction_0(int, int)':<BR>
/tmp/ccv7OZu3.o(.text+0x1b6): undefined reference to `std::ios_base::Init::Init[in-charge]()'<BR>
/tmp/ccv7OZu3.o: In function `__tcf_0':<BR>
/tmp/ccv7OZu3.o(.text+0x1e5): undefined reference to `std::ios_base::Init::~Init [in-charge]()'<BR>
/tmp/ccv7OZu3.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'<BR>
collect2: ld returned 1 exit status<BR>
<BR>
Does anyone know what I can do about this?<BR>
<TT></TT><BR>
<BR>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<PRE>-- Zach Schimke</PRE>
</TD>
</TR>
</TABLE>

</BODY>
</HTML>

------=_Part_3_5619631.1042089611117--