您的位置:首页 > 大数据 > 人工智能

linker command failed with exit code 1 (use -v to see invocation)

2016-07-21 20:21 393 查看
在开发过程中,这种问题很常见,而且不像一般的代码逻辑或者语法问题,很难解决。下面把遇到过的常见问题解决方案记录一下,希望给各位小伙伴提供一点帮助。

一、导入文件错误,#import “Class.m” 文件



解决办法:(把导入的.m文件,换成相应的.h即可)



二、重复导入文件



解决办法:(把多余的重复文件删除)



三、循环导入

情况描述:VC1 导入VC2,VC2导入VC1可能导致linker failed问题;

解决办法:在.m文件进行导入,而不是.h;或者在.h中用 @calss Calss进行解决

四、升级Xcode7升级到Xcode8导致的linker command failed

错误截图:





解决办法:项目->TARGETS-> Build phases ->No common Blocks = NO;



出现的原因:

In C, allocate even uninitialized global variables in the data section of the object file, rather than generating them as common blocks. This has the effect that if the same variable is declared (without extern ) in two different compilations, you will get an error when you link them. The only reason this might be useful is if you wish to verify that the program will work on other systems which always work this way.

在C语言中,在目标文件的数据段分配甚至未初始化的全局变量,而不是生成它们作为公共块。这样做,如果同一个变量被声明(没有extern)放在两个不同的汇编,你会当你将它们链接得到一个错误的影响。这可能是有用的唯一原因是,如果你想验证程序将在其他系统上,它总是以这种方式工作工作。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  常见Bug