22

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?

DaveR
  • 9,540
  • 3
  • 39
  • 58
SKayser
  • 351
  • 1
  • 3
  • 6

19 Answers19

33

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

Evan Moran
  • 3,825
  • 34
  • 20
  • 7
    it's going to be a rather big text file. be sure to search 'exit code 1' and the description will be right above the results. – Alex Nguyen Dec 31 '10 at 00:40
  • 1
    @SeniorLee: I believe you don't need it, just look at the lines before that one and it's already there! – o0'. Feb 03 '12 at 11:22
11

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.

itsaboutcode
  • 24,525
  • 45
  • 110
  • 156
apoorv shah
  • 171
  • 3
  • 12
7

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.

Aviad Ben Dov
  • 6,351
  • 2
  • 34
  • 45
  • I was working with an outdated project, bringing it up to date, and all of my frameworks were disabled. I had to reset the deployment target and reimport frameworks, but this fixed me – Daddy Nov 06 '10 at 01:42
6

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!

SKayser
  • 351
  • 1
  • 3
  • 6
4

You can see the error message output from GCC by selecting "Build Results" from the "Build" menu or by pressing ⇧⌘B.

Dave Verwer
  • 6,140
  • 5
  • 34
  • 30
4

you have defined the same static constants!!!!

static NSString *kSectionTitleKey = @"sectionTitleKey";
static NSString *kSectionTitleKey = @"sectionTitleKey";

the problem is

nothing about the CoreGraphics.framework

Nitish
  • 13,845
  • 28
  • 135
  • 263
Sage
  • 120
  • 6
  • What `kSectionTitleKey`? What are you refering to? – sth Dec 14 '09 at 09:17
  • 我英文不好,就是你定义了相同的静态常量. You defined the same static constants,This is the reason for the error! – Sage Dec 15 '09 at 07:18
  • 1
    did you konw how to save pictures from one of my Application to PhotoLibrary? – Sage Dec 15 '09 at 07:21
  • UIImage *imageSave = [UIImage imageNamed:@"1.jpg" ]; UIImageWriteToSavedPhotosAlbum(imageSave, nil, nil, nil); I have known – Sage Dec 15 '09 at 07:51
2

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.

Alex Nguyen
  • 2,820
  • 1
  • 19
  • 14
2

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.

AJPatel
  • 2,291
  • 23
  • 42
  • I had this error using a testing framework (KIF). During install two KIF cocoapod libraries with slight naming variation had been linked to the project. Removing one solved the problem. – The Camster Jan 20 '14 at 23:15
2

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 :)

sasquatch
  • 285
  • 2
  • 13
2

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.
sinh99
  • 3,909
  • 32
  • 32
1

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.

Rob Hruska
  • 118,520
  • 32
  • 167
  • 192
1

I had the same problem. The reason was, I had two int main(int argc, char *argv[]) functions.

Brock Adams
  • 90,639
  • 22
  • 233
  • 295
xiaogong
  • 11
  • 1
1

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!!!

Albert
  • 11
  • 1
1

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).

Developer
  • 6,375
  • 12
  • 58
  • 92
1

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.

johndpope
  • 5,035
  • 2
  • 41
  • 43
1

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.

aibin
  • 11
  • 1
1

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!

0

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

user674669
  • 10,681
  • 15
  • 72
  • 105
0

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

prodeveloper
  • 943
  • 14
  • 22