neilthawani
neilthawani

Reputation: 45

Xcode 4 - clang: error: linker command failed with exit code 1 (use -v to see invocation)

I keep getting the following error when trying to Build my project. I did a Google search and found some folks who had the same name for their variables between classes and/or forgot to include/had multiple inclusions of some classes in their Linker, but this is not the case for me.

Please see the below picture:

Xcode Error

Upvotes: 0

Views: 2756

Answers (1)

JDS
JDS

Reputation: 1173

As it says in the error it can't find the main function. Normally in an iOS Project this function comes with the template and looks something like this:

int main(int argc, char *argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}

It is needed because the main function is the entrance point for every C, C++ and Objective-C program. It is located in a file called main.m in the Supporting Files group (which doesn't mean you're not allowed to move it elsewhere).

To fix this error, look if the file/the function exists. If they do, open the utilities pane (the right one), go to the first tab and look if the checkbox of the target is selected.

Upvotes: 1

Related Questions