Apple Mach-O Linker Error
是一类错误,错误信息的最后一行,通常如下
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang failed with exit code 1
是一类错误,错误信息的最后一行,通常如下
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang failed with exit code 1
发生这种错误的原因通常是因为两个子工程中存在同名类造成的链接错误。
比如我发生错误的原因就是因为在两个.m文件中都定义了同样名字的const变量。
虽然给的错误信息不明显,但是点开还是可以发现一些信息,从而定位的。但是信息很多,需要仔细排查,这次就是在众多的信息中发现了那个变量的命名,从而找到这个问题,通常你的变量都会被加一些前后缀显示。
To add onto the list of weird stuff that fixed this issue...
I had some const CGFloat variables in a global header file like so
constNSInteger globalInteger1 =2;
constNSInteger globalInteger2 =3;
The moment I removed these, all was fine :)
注:除了frameWork问题之外,还需注意头文件定义变量(常量)问题,变量不能在头文件中定义,只可以声明
常量需加上 const static xxx
否则就要extern const xxx声明, 然后在.m 或者 .c中定义