Results 1 to 2 of 2
  1. #1

    Member Since
    Dec 21, 2009
    Error from Xcode making no sense to me????
    I wanna study the C++ in XCode. After installing, I just inputted a following sample code,

    #include <iostream>
    using namespace std;

    int main()
    int iterations = 0;
    bool continue_loop = true;
    while ( continue_loop != false )
    cout << "the while loop has executed "
    << iterations << " times\n";
    if ( iterations == 5 )
    continue_loop = false;
    return 0;

    but the XCode said "it is fail", the reason is
    "duplicate symbol _main in /Users/roger/Documents/Try/build/ and /Users/roger/Documents/Try/build/"

    so please help me, is it my mistake to install the xcode or open a wrong file, or some reasons.

    Thank you very much..........

  2. #2

    Raz0rEdge's Avatar
    Member Since
    Jul 17, 2009
    27" i7 iMac, 24" iMac, 13" Macbook Air, iPhone 5 & 5S, iPod Nano 7th Gen, iPad 2 16GB WiFi, iPad 3
    The error code actually makes perfect sense, you have 2 "main" functions which isn't allowed. Every program you create can only have one main function, because that's the function that is run FIRST when the application is run. Looks like you have possibly two files called "Try.cpp" and "main.cpp"??

    How did you create the XCode project for your test?


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Airport Express, making no sense ...
    By Koffielepel in forum Internet, Networking, and Wireless
    Replies: 2
    Last Post: 06-13-2014, 02:18 PM
  2. Sense Error 0X73 0X3 Superdrive cleaning kit
    By mrblue in forum Apple Notebooks
    Replies: 7
    Last Post: 02-09-2011, 03:53 PM
  3. Error from Xcode making no sense to me
    By TrueHeresy in forum OS X - Operating System
    Replies: 4
    Last Post: 12-18-2009, 02:12 PM
  4. Making sense of Word
    By Griffo in forum OS X - Apps and Games
    Replies: 6
    Last Post: 10-21-2008, 02:29 PM
  5. making sense of parallels vs fusion debate
    By discosammy in forum Running Windows (or anything else) on your Mac
    Replies: 6
    Last Post: 07-24-2008, 02:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts