Reputation: 351
I've seen this error with different variations on discussion forums but being a non programmer I'm not sure how to progress this.
Basically I have code which I found to help me with changing the background colors of cells on a grouped uitableview. The code introduced a line as such:
CGContextAddArcToPoint(c, minx, miny, midx, miny, ROUND_SIZE);
This gave an error indicated that it wasn't declared, so I added to my .h file the following under import uikit:
#import <UIKit/UIKit.h>
#define ROUND_SIZE 10
Now it shows that I have an error:
Command/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1 iphone
Some discussions talk about libraries but because I don't have a programming background I don't understand what to do. I also see that some people show a log output but I'm not sure where that comes from as I don't get any debug windows because I'm guessing it doesn't get that far. I simply click 'Build and Go' and I get this error in the Message window.
Any thoughts?
Upvotes: 22
Views: 90689
Reputation: 950
Here is one of the possible solutions:
Remove the .m(implementation) file import statement from the viewController class if it is included along with related .h(header) file.
Instead of including (by mistake)
#include "myClass.h"
#include "myClass.m"
Include only the required header file as:
#include "myClass.h"
Thanks, Prodeveloper
Upvotes: 0
Reputation: 11
I've gotten the same error and solved in a very strange way. Cleaning and rebuilding the project doesn't solve it but simply adding an empty line in ApplicationViewController.mm
has forced the compiler to rebuild "something" and the error has gone by itself.
I just add that the same project compiles without error on iMac and failed on macBook.
Upvotes: 1
Reputation: 12342
I was getting this error on building a cocos2d project using xcode 4.3 on Lion. To fix this error, I followed the instructions here: http://www.mac.ph/cocos2d-templates-and-xcode-43
Upvotes: 0
Reputation: 3979
xcode build errors:
Unsupported compiler ‘GCC 4.2′ selected for architecture ‘i386′
Solution:
This can be caused by importing a project for a pre- iOS 5 SDK into a copy of xcode with iOS 5 SDK only.
To fix,
click your Project -> Build Settings. Then under Build Options, there is an entry for Compiler for C/C++/Objective-C. Choose Apple LLVM compiler 3.0.
Upvotes: 2
Reputation: 11
I had the same problem. The reason was, I had two int main(int argc, char *argv[])
functions.
Upvotes: 1
Reputation: 285
Another fix to this problem that was the answer to my fix was that I had two classes with the same name. A webservices helper had created an Invoice class, and when I tried to add a file with that same name it didn't have any problems until I tried to compile.
So make sure all your classes have unique names :)
Upvotes: 2
Reputation: 120
you have defined the same static constants!!!!
static NSString *kSectionTitleKey = @"sectionTitleKey";
static NSString *kSectionTitleKey = @"sectionTitleKey";
the problem is
nothing about the CoreGraphics.framework
Upvotes: 4
Reputation: 2291
This type of exit code error occures due to Any of your framework or Library overlap. so solve this problem check your error log and find out duplicate object symbols waring in log than you got actual file which is overlap in code.
Upvotes: 2
Reputation: 11
I had the same problem, noticed that it was looking for a file in the wrong folder, essentially, don't store projects in folders with apostrophes in their name!
Upvotes: 1
Reputation: 11
This issue could be because some libraries might be missing. Right click on the error line and click on "Open these results as transcript text files" and check the missing library.
Upvotes: 1
Reputation: 2820
Evans answer is the best thing you can do to find the exact reason of why you are having that error. In most cases, in my experience, is that there have been files that have been deleted but haven't been removed from the project.
Upvotes: 2
Reputation: 5249
For me, I found the solution above helpful.... "Open These Latest Results as Transcript Text File" which explained it couldn't find libGDataTouchStaticLib.a. I then had to build the static library for Gdata.xcodeproj (changing the active target > GdataTouchStaticLib) then had to manually add this file by dragging it to the targets > MYAPPNAME > Link Binary With Libraries. Build & Run.. All Good.
Upvotes: 1
Reputation: 4173
As you can see from the many different responses this error is caused by many different problems. Luckily, I have found the Meta Solution!
In xcode, right click the error line and choose "Open These Latest Results as Transcript Text File". This will open the real xcode output log, which should contain a better description of the error then was previously seen.
-Evan
Upvotes: 33
Reputation: 6465
This problem also arises when you rename the XIB file. You have to replace the old name with the new name in the xib files as well as in the navigation controller (if used).
Upvotes: 1
Reputation: 11
When u create a file , u have to disable [uncheck] cocos2d libraries & then add the file. so that gcc-4.2 error will be rectified :) checkout!!!
Upvotes: 1
Reputation: 171
I have gone through that same problem. There may be some file which has no refference . You can see that type of file in red letter. Remove that file.
Upvotes: 11
Reputation: 351
I've found the problem after seeing the Build Results window that Dave mentioned (thank you!!!). I had a different version of the same .h and .m file because I was testing with different code. I deleted the unnecessary files as it was seeing something in there as a duplicate. The build was successful. Thank you!
Upvotes: 6
Reputation: 6179
You can see the error message output from GCC by selecting "Build Results" from the "Build" menu or by pressing ⇧⌘B.
Upvotes: 4
Reputation: 6409
You probably don't have the CoreGraphics.framework added to your frameworks list.
To make sure, click the "Frameworks" folder on Xcode. If the framework isn't listed on the table to the right, you'll need to add it by right-clicking the Frameworks folder, chooseing "Add Existing Framework..." and then choosing it from the list.
Upvotes: 7