clang failed with exit code 1 error - iphone

I have downloaded a sample code of OpenEars form the web, in that at a place these statements were using:
#autoreleasepool {
…
}
which was giving error: Unexpected '#' in program, then I replaced these lines of code with:
NSAutoreleasePool *pool = [NSAutoreleasePool new];
…
[pool drain];
and now I am getting error: "clang failed with exit code 1 error".
Does any one know how to solve this?
I am using XCode 3.2.5

You definitely want to go back to #autoreleasepool{} but it sounds like the issue is in the compiler/arguments though. That may be difficult to debug, depending on how old the project was. Are you using the latest Xcode, and if so, can you "upgrade project settings"?

Related

VSCode showing weird errors in my Haxe Code

i just started learning Haxe today and i got a couple of problems with my VSCode.
There are 3 "Errors" in total, to be exact 2 errors and 1 info, but the info seems kind of wrong and i would like to know how to get rid of it aswell.
Before i go into more detail, some info that might be relevant:
I created my project using the "Haxe: Initialize Project" from the Haxe VSCode extension
I changed nothing in the build.hxml file
If i run my code via VSCode (Ctrl-Shift-B) i get an error
If i run it on a normal CMD with "haxe build.hxml" it works totally fine, no errors at all
The Code:
class Main {
static function main() {
trace("Hello, World!");
var t:String = Sys.stdin().readLine().toString();
trace(t);
}
}
The build.hxml file:
-cp src
-D analyzer-optimize
-main Main
--interp
The first error i get:
It seems that this error is not even in my own file, how can this be?
The Sys.stdin().readLine() seems to have something to do with it, since this error came the moment i added this line.
Uncaught exception Not implemented in haxe.io.input.readByte at haxe/io/Input.hx tasks [180. 1]
Screenshot from VSCode
The second error i get:
Once again it seems to have something to do with Sys.stdin().readline() this time this exact part of my code is red underlined and the error message is pointing at this exact line.
Called from here tasks [4, 18]
Screenshot from VSCode (Error)
Screenshot from VSCode (red underline)
The (kind of) error / Info i get:
This is the most weird one imho..
Its a blue "~" i get at the beginning of my trace("Hello, World!"); line.
Screenshot from the weird Blue Symbol
Screenshot from the VSCode "Problem" regarding this line
Thanks in advance!
I looked through the internet the whole day hoping to find something to get this things solved on my own, but since its my first time ever using Haxe and i was not able to find something even similar to this i hope some of you 5heads out there can help me with this. :)

Xcode 5.1.1 Thread 1: signal SIGABRT

When i run my app, after a while it stops working and say thread 1: signal SIGABRT. it says it on this code:
#import <UIKit/UIKit.h>
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}
It says it on this line:
int retVal = UIApplicationMain(argc, argv, nil, nil);
SIGABRT means an exception was triggered. The console log will print the exact exception message, and you need to look at that (post it here).
The problem is probably in your UIApplicationMain method
To Expand on user3109992 answer a SIGABRT usually means an exception was thrown. Generally you want to enable a global exception breakpoint so that your program will be stopped on the line of code that generated the exception rather than just crashing on main so that you can gain some meaningful information as to what happened.
To set a global breakpoint use the breakpoint navigator (looks like a diamond) on your left bar (or command 7). On the lower left click the + icon and choose "Exception Breakpoint". Now your program will crash at the point the exception is thrown. However this still won't print the actual exception to the console.
To print the exception to the console when the crash occurs select the stack frame that says something like "objc exception throw", it will be at the top of the left window. If your running on simulator type: po $eax and in general the exception will be printed to the console. Note that sometimes the register where the exception is located is different if your on a device or the 64 bit simulator so you can type: "register read" and it will give you a list of registers. The one at the top holds the exception so you can type: "po " to see it. You can have the exception print automatically when your program crashes at main by setting "Log Exceptions" in the scheme (product -> scheme-> edit scheme), accessed by choosing the diagnostic tab in the edit scheme window. However if you have a breakpoint set then your breakpoint will stop the program before the debugger gets a chance. I prefer the breakpoint approach because I usually want to poke around to understand more of whats going on when the app crashed.
I'd suggest you go back and watch some of the debugging and LLDB videos from the past couple of WWDC's as it sounds like you don't have a whole lot of experience with the debugger. The beginning videos have a ton of useful information.

My phone app is suddenly crashing because of the main.m file

Suddenly when I try to run my app it immediately goes to the main.m file and shows me this SIGABRT error which I'm going to assume is Signal abort. I just can't figure out why that is happening. And I'm not sure what I am looking at in my debugging area. Please help!
#import <UIKit/UIKit.h>
#import "Mct2AppDelegate.h"
int main(int argc, char *argv[])
{
#autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([Mct2AppDelegate
class]));
}
}
Debugger Output:
Attaching to process 8004.
Pending breakpoint 1 - ""main.m":17" resolved
Couldn't register com.ebonybutler.Mct2 with the bootstrap server. Error: unknown error code.
This generally means that another instance of this process was already running or is hung in the debugger.Current language: auto; currently objective-c
Second Debugger Output since restart:
2012-02-29 16:46:45.561 Mct2[319:f803] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "Menu" nib but the view outlet was not set.'
* First throw call stack:
(0x13bb052 0x154cd0a 0x1363a78 0x13639e9 0xd7f0d 0xd83a9 0x2415e2 0xd85cb 0x25e4 0x13bcec9 0x155c2 0x1555a 0xbab76 0xbb03f 0xba2fe 0x3aa30 0x3ac56 0x21384 0x14aa9 0x12a5fa9 0x138f1c5 0x12f4022 0x12f290a 0x12f1db4 0x12f1ccb 0x12a4879 0x12a493e 0x12a9b 0x2032 0x1fa5)
terminate called throwing an exceptionCurrent language: auto; currently objective-c
Simple fix, if you're using iOS simulator, just close it down and rerun the project
This is Happens because your application getting terminate.
Try the following things in the below order:
Make sure all only one program is being debugged in XCode, close other running instances.
shut down your system and restart it before doing third steps.
Restart XCode, most of time this is take care of the issue.
If you are running this on the device and is still not working restart the device and try again.
It Really Work.

iphone: co-processor offset out of range

i have a strange compiling problem with xcode and iphone. my game is almost finish but now i got suddently this compiling error:
{standard input}:6108:co-processor offset out of range
gcc-4.2 failed with exit code 1
this only happens if i compile the release version for the device. the debug version and both versions for the simulator works. clean targets and recompile don't work.
strangly enough that error only happens if i add a line of code to one specific source file and only between these lines:
[_sharedDirector checkAndPutScoreToHighscore:(int)[player score]];
gameOverScreen = YES;
gameOverScreenSlideY = 320.0f;
[buttonManager activateButtonWithID:replayButton];
[buttonManager activateButtonWithID:menuButton];
so when i put a random line between this lines of code i get that error.
i do not know what causes this error. i had opened the sourcecode file to "show as assembly file" just for fun but i don't think this has caused the error.
has anybode a hint for me what could be going on? i am searching the web for over 3 hours and thats very frustrating.
You most likely found a compiler bug. You really should switch to the LLVM compiler (clang).

Strange, Sudden compiler fail error in Xcode for iPhone dev

What is the following error caused by? I did not make any significant changes and suddenly it started appearing:
Linking /Users/JimB/Desktop/iPhone Dev/Games4Kids/build/Debug-iphonesimulator/ETFanClub.app/Games4Kids(1 error)
duplicate symbol .objc_category_nameNSString_HTTPExtensions in (path)ViewController3 and (path)ViewController1
Command /Xcode 3.1.4/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1
The symbol .objc_category_nameNSString_HTTPExtensions is duplicated, meaning the category NSString(HTTPExtensions) is declared twice ViewController3 and ViewController1.
Check that you don't have #implementation's in the headers #import-ed by both of these files, and they don't both have #implementation NSString(HTTPExtensions) simultaneously.