在C99中隐式声明函数objc_getAssociatedObject是无效的。

17

我正在尝试在我的Objective-C分类中使用关联对象,但是我收到了这个警告。

Implicit declaration of function 'objc_getAssociatedObject' is invalid in C99

另外,我正在使用arc,如果这有区别的话。

2个回答

54

你是否已经添加了?

#import <objc/runtime.h>

在你的文件开头?


谢谢你的回答,它解决了我的问题,但这个库是用来做什么的? - antf
@antf - http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/ObjCRuntimeRef/Reference/reference.html@antf - http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/ObjCRuntimeRef/Reference/reference.html - cnotethegr8

0

在绘制函数之前,我复制了这些行代码,现在它工作了。

GL_API void GL_APIENTRY glEnableClientState (GLenum array);

GL_API void GL_APIENTRY glDisableClientState (GLenum array);

GL_API void GL_APIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);

GL_API void GL_APIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接