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

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?
 
Without exit code 1? ;)

Are you using Xcode? Can you paste a screenshot? You have not given us very much information to help you...
 
sure! and sorry but it says failed with exit code 1 if i try to program more than 1 file in one destination.
 

Attachments

  • error1.jpg
    error1.jpg
    123.9 KB · Views: 115
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.
 
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

  • error.jpg
    error.jpg
    204.7 KB · Views: 87
He's not talking about the file name but the function name. blah has a main() function.
 
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.