Error: multiple definitions of symbol _main

Hi everyone!

Last week I went to a C++ course in uni. We learnt some of the basics of C++ and our final exam was to write a program that gave out the Mandelbrot set on a canvas.
So, today I tried to run the program at home but I got the following error:

/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: multiple definitions of symbol _main
class.o definition of _main in section (__TEXT,__text)
exam.o definition of _main in section (__TEXT,__text)
collect2: ld returned 1 exit status

That error came up when I was trying to bind(is that the correct word?) the programm using

g++ -o draw *.o

class.o is a programm defining complex numbers and exam.o is the one which should "draw" the mandelbrot set on the canvas.

Everything worked fine in uni, so I don't know where the problem is.

Any help would be much appreciated!

-frike
The correct word is "link".

First of all, make sure you only have one main function! If you have one in "class.o" and one in "exam.o", you need to remove one.

If you only have one main function, you might have done someting wrong when compiling these files. Can you show the commands you used to create these files?
Oops, I had two main functions. Thanks for your help!
Topic archived. No new replies allowed.