xcode user error?

Discussion in 'Mac Programming' started by bravens52, Jan 21, 2010.

  1. bravens52 macrumors regular

    Jul 16, 2009
    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
  2. HiRez macrumors 603


    Jan 6, 2004
    Western US
    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).
  3. lee1210 macrumors 68040


    Jan 10, 2005
    Dallas, TX
    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.


Share This Page