This is the mail archive of the gcc-help@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]

RE: Help for GCC newbie


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.


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