Help for GCC newbie

Rupert Wood me@rupey.net
Wed May 1 00:40:00 GMT 2002


Mark Grimshaw wrote:	

> I compile my program using:
> g++ -W -pedantic -o test.o test.cpp  (this works ok)
> g++ -o test.exe test.o
: 
> test.o: In function `main':
> /home/mark/C++programming/test.cpp:14: multiple definition of 
> `__dso_handle'

You're actually generating an executable in the first step and not an
object file. (The error occurs because you're then attempting to re-link
the executable with all the standard libraries.) You probably want to
add '-c' to the first command line to compile without linking.

As a side note, you probably also want to add either '-g' to both steps
to include debugging information in the executable, or add '-O2' to the
first to build an optimised release.

Hope that helps,
Rup.



More information about the Gcc-help mailing list