linker command failed with exit code 1 (use -v to see invocation)
2016-07-21 20:21
393 查看
在开发过程中,这种问题很常见,而且不像一般的代码逻辑或者语法问题,很难解决。下面把遇到过的常见问题解决方案记录一下,希望给各位小伙伴提供一点帮助。
解决办法:(把导入的.m文件,换成相应的.h即可)
解决办法:(把多余的重复文件删除)
解决办法:在.m文件进行导入,而不是.h;或者在.h中用 @calss Calss进行解决
解决办法:项目->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)放在两个不同的汇编,你会当你将它们链接得到一个错误的影响。这可能是有用的唯一原因是,如果你想验证程序将在其他系统上,它总是以这种方式工作工作。
一、导入文件错误,#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)放在两个不同的汇编,你会当你将它们链接得到一个错误的影响。这可能是有用的唯一原因是,如果你想验证程序将在其他系统上,它总是以这种方式工作工作。
相关文章推荐
- linker command failed with exit code 1 (use -v to see invocation)
- Undefined symbols for architecture i386: “_OBJC_CLASS_$_XXX”, referenced from: objc-class-ref in XXX
- android开发之常见的android开发错误及解决方案
- 树形DP——Party a Haili-Bula ( HDU 3342 )
- 2016 Multi-University Training Contest 2 第一题Acperience
- 人工智能算法
- HDU 5738 Eureka (from: 2016 Multi-University Training Contest 2)
- pthread_cond_wait()用法分析
- 2016 Multi-University Training Contest 2 HDU 5744 Keep On Movin
- 2016 Multi-university training contest
- 2016 Multi-University Training Contest 2
- 2016 Multi-University Training Contest 2 1009 It's All In The Mind
- UVA - 10494 If We Were a Child Again
- HDU 2016 Multi-University Training Contest 2 1001
- 2016 Multi-University Training Contest 2 hdu 5734 Acperience【推公式,数学】
- 2016 Multi-University Training Contest 2 A Acperience
- 2016 Multi-University Training Contest 2 Keep On Movin
- Gym 100646 You’ll be Working on the Railroad dfs
- 个人学习:main()函数