12-21-2009, 03:05 AM #1
Error from Xcode making no sense to me????
- Member Since
- Dec 21, 2009
I wanna study the C++ in XCode. After installing, I just inputted a following sample code,
using namespace std;
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;
but the XCode said "it is fail", the reason is
"duplicate symbol _main in /Users/roger/Documents/Try/build/Try.build/Debug/Try.build/Objects-normal/x86_64/Try.o and /Users/roger/Documents/Try/build/Try.build/Debug/Try.build/Objects-normal/x86_64/main.o"
so please help me, is it my mistake to install the xcode or open a wrong file, or some reasons.
Thank you very much..........
12-21-2009, 09:06 AM #2
- Member Since
- Jul 17, 2009
- 27" i7 iMac, 24" iMac, 13" Macbook Air, iPhone 6S, iPod Nano 7th GeniPad 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?
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
By Koffielepel in forum Internet, Networking, and WirelessReplies: 2Last Post: 06-13-2014, 02:18 PM
By mrblue in forum Apple NotebooksReplies: 7Last Post: 02-09-2011, 03:53 PM
By TrueHeresy in forum OS X - Operating SystemReplies: 4Last Post: 12-18-2009, 02:12 PM
By Griffo in forum OS X - Apps and GamesReplies: 6Last Post: 10-21-2008, 02:29 PM
By discosammy in forum Running Windows (or anything else) on your MacReplies: 6Last Post: 07-24-2008, 02:36 PM