当我使用模拟器时 - >发布配置代码运行正常。但如果我使用模拟器 - >调试配置给我以下错误
Undefined symbols:
"_AGTileInfoEqualToAGTile", referenced from:
-[TiledScrollView loadTileAtPoint:] in TiledScrollView.o
"_AGTileInfoMake", referenced from:
-[TiledScrollView loadTilesIfNeeded] in TiledScrollView.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
以下是代码
typedef struct
{
NSString *dataSet;
NSInteger level;
NSInteger x;
NSInteger y;
}AGTileInfo;
/* Make a AGTileInfo */
inline AGTileInfo AGTileInfoMake(NSString *dataSet, NSInteger level, NSInteger x, NSInteger y);
inline AGTileInfo
AGTileInfoMake(NSString *dataSet, NSInteger level, NSInteger x, NSInteger y)
{
AGTileInfo tInfo; tInfo.dataSet = dataSet; tInfo.level = level; tInfo.x = x; tInfo.y = y; return tInfo;
}
inline bool AGTileInfoEqualToAGTile(AGTileInfo info1, AGTileInfo info2);
inline bool
AGTileInfoEqualToAGTile(AGTileInfo info1, AGTileInfo info2)
{
return [info1.dataSet isEqualToString:info2.dataSet] && (info1.level==info2.level) && (info1.x == info2.x) && (info1.y == info2.y) ;
}
提前致谢。
答案 0 :(得分:1)
你是否尝试过没有“内联”条款进行编译?
答案 1 :(得分:0)
感谢xj1200。他的链接非常有帮助。我所做的只是在内联之前添加“静态”修饰符。这是新代码,它工作正常。
static inline AGTileInfo AGTileInfoMake(NSString *dataSet, NSInteger level, NSInteger x, NSInteger y);
static inline AGTileInfo
AGTileInfoMake(NSString *dataSet, NSInteger level, NSInteger x, NSInteger y)
{
AGTileInfo tInfo; tInfo.dataSet = dataSet; tInfo.level = level; tInfo.x = x; tInfo.y = y; return tInfo;
}
static inline bool AGTileInfoEqualToAGTile(AGTileInfo info1, AGTileInfo info2);
static inline bool
AGTileInfoEqualToAGTile(AGTileInfo info1, AGTileInfo info2)
{
return [info1.dataSet isEqualToString:info2.dataSet] && (info1.level==info2.level) && (info1.x == info2.x) && (info1.y == info2.y) ;
}