iOS make my program work when one project has two c program files

ssaeed

macrumors newbie
Original poster
Jan 13, 2012
4
0
I cant seem to make my program work when one project has two c program files! it says build failed without exit code 1. can anyone please help?
 

ianray

macrumors 6502
Jun 22, 2010
452
0
@
Without exit code 1? ;)

Are you using Xcode? Can you paste a screenshot? You have not given us very much information to help you...
 

ssaeed

macrumors newbie
Original poster
Jan 13, 2012
4
0
sure! and sorry but it says failed with exit code 1 if i try to program more than 1 file in one destination.
 

Attachments

robbieduncan

Moderator emeritus
Jul 24, 2002
25,286
568
Harrogate
You can't have the same C function name twice in a single executable. So you can only have main once. Which is exactly what the error tells you.
 

ssaeed

macrumors newbie
Original poster
Jan 13, 2012
4
0
im sorry i dont understand! one file has name "main" and the other has "blah". Why is it not possible to program more than one file in one project? thanks
 

Attachments

subsonix

macrumors 68040
Feb 2, 2008
3,551
79
He's not talking about the file name but the function name. blah has a main() function.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,286
568
Harrogate
He's not talking about the file name but the function name. blah has a main() function.
Exactly. This has absolutely nothing to do with the number of files or the file names. If you copy and pasted the content from blah to the other file and only had one file you'd get the same problem as there would be two main functions. Functions are globally scoped so you cannot have the same function name twice regardless of which file it is in.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.