Mach-o Linker Error

2019-02-28 07:11发布

I can't build my project because I keep getting this error. As I understood it deals with the constant tagShift I'm using in my code. I would appreciate if anyone could help me to solve this issue enter image description here

2条回答
Explosion°爆炸
2楼-- · 2019-02-28 07:42

I guess you have included TrafficLightG.h in more than one file.

#include "TrafficLightG.h"

Declare your const in that way:

TrafficLightG.h

const int tagShift;

TrafficLightG.m

 const int tagShift = 90;

PS: use NSInteger or NSUInteger instead of int.

查看更多
爷、活的狠高调
3楼-- · 2019-02-28 07:48

I had faced the same issue someday and figured out the result as:

Here You have a int tagShit of constant type. So you can not make constant type variables of same name in two or more classes. Change that tagShit variable name in one of the class (may be as tagShift1 or anything else) and it will be good to go.

Hope it'll help you.

查看更多
登录 后发表回答