GCC, C++, and broken linking
Thomas Tate
plug-discuss@lists.plug.phoenix.az.us
Wed, 8 Jan 2003 22:28:04 -0700
Oddball thing with GCC is that if you need to compile a C++ program that
has a nonstandard C++ extension in the filename (eg: blah.c++ or
similar), GCC's frontend won't know how to ultimately link it. The
solution is not to compile it with the usual gcc command, but with the
g++ command. This will invoke the C++ compiler directly (command line
args are identical as those used for gcc) and take care of the
unresolved symbols.
Also, as a side note, I would not suggest building a C++ application on
anything older than GCC 3.0 using the STL, as the implementations before
3.0 seem to be rather broken (missing classes, etc.)
On Wed, 8 Jan 2003 8:43PM -0700, 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:
>
> /tmp/ccv7OZu3.o: In function `main':
> /tmp/ccv7OZu3.o(.text+0x36): undefined reference to
...snip...
> Does anyone know what I can do about this?
>
>
> -- Zach Schimke
--
Thomas "Mondoshawan" Tate
mondoshawan@tank.dyndns.org
http://tank.dyndns.org:8080