Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

bravens52

macrumors regular
Original poster
Jul 16, 2009
110
0
I just finished my first program for my c++ class and im trying to build and run the program but im getting a error and i dont know what it means and i wanted to know if anybody know what i need to fix.


ld: duplicate symbol _main in /Users/Admin/Documents/assgn1/build/assgn1.build/Debug/assgn1.build/Objects-normal/x86_64/JhavelHayes.o and /Users/Admin/Documents/assgn1/build/assgn1.build/Debug/assgn1.build/Objects-normal/x86_64/main.o
 
I just finished my first program for my c++ class and im trying to build and run the program but im getting a error and i dont know what it means and i wanted to know if anybody know what i need to fix.


ld: duplicate symbol _main in /Users/Admin/Documents/assgn1/build/assgn1.build/Debug/assgn1.build/Objects-normal/x86_64/JhavelHayes.o and /Users/Admin/Documents/assgn1/build/assgn1.build/Debug/assgn1.build/Objects-normal/x86_64/main.o

Did you name a variable or function "main" that is not the main entry point of your program? You can't do that since it's a reserved keyword. Or do you have more than one "main" function in separate files? There can only be one main function. If not, posting the code would probably help (wrapped in CODE tags of course).
 
From the looks of it there is the auto-generated main.cpp that contains a main function when it is created, and you then created a new file JhavelHayes.cpp which you defined a new main in. You'll need to pick one, and delete the other.

-Lee
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.