OS X program won't compile EXC_BAD_ACCESS

I'm trying to learn XCode and Mac programming. I'm trying a program from a book on XCode 4, and I'm using 4.2.1. I've been told that the error isn't the tagged line of code below. How/where can I de-bug this? A search didn't turn up anything I understood.

In main.m - "Thread1 Program received signal 'EXC_BAD_ACCESS'.

int main(int argc, char *argv[])
{
    return NSApplicationMain(argc,(const_char **)argv); //error here   
}

I don't find a Stack Navigator in View|Navigators.

Maybe this is what you're looking for?

I deleted the whole project and started over. Now I get a SIGABRT on the same line. Searching on that hasn't led to any resolution.

Answers


Zombie objects are great for debugging bad access.

In Xcode 4.1 and above, there's also checkbox on the "Diagnostics" tab of the "Run" stage to "Enable Zombie Objects". - from How to enable NSZombie in Xcode?


I found it very helpful to add an exception break point (via the + button in the lower left corner in the Breakpoint Navigator and set it to break on all exceptions when thrown. Click on the blue arrow in the list to switch it on and off as you need it. It will stop right at the source code position that threw the exception.


 return NSApplicationMain(argc,(const_char *)argv); 

get rid of 2nd asterisk


Need Your Help


About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.