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

北城以北 提交于 2019-12-12 05:18:40

问题


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:


回答1:


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.



来源:https://stackoverflow.com/questions/17822208/xcode-4-clang-error-linker-command-failed-with-exit-code-1-use-v-to-see-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!