I copy some code from another project and I work fine in previous project but in new project I get linking error:
OpengLWaveFrontCommon.h:50:22: error: cannot initialize a variable of type 'VertexTextureIndex *' with an rvalue of type 'void *' VertexTextureIndex *ret = malloc(sizeof(VertexTextureIndex));
This file (OpengLWaveFrontCommon.h) is a part of openGL iPhone project: Wavefront OBJ Loader. https://github.com/jlamarche/iOS-OpenGLES-Stuff
Should I make some special flag or something, because it is C structured?
#import <OpenGLES/EAGL.h>
#import <OpenGLES/ES1/gl.h>
#import <OpenGLES/ES1/glext.h>
typedef struct {
GLfloat red;
GLfloat green;
GLfloat blue;
GLfloat alpha;
} Color3D;
static inline Color3D Color3DMake(CGFloat inRed, CGFloat inGreen, CGFloat inBlue, CGFloat inAlpha)
{
Color3D ret;
ret.red = inRed;
ret.green = inGreen;
ret.blue = inBlue;
ret.alpha = inAlpha;
return ret;
}
#pragma mark -
#pragma mark Vertex3D
#pragma mark -
typedef struct {
GLfloat x;
GLfloat y;
GLfloat z;
} Vertex3D;
typedef struct {
GLuint originalVertex;
GLuint textureCoords;
GLuint actualVertex;
void *greater;
void *lesser;
} VertexTextureIndex;
static inline VertexTextureIndex * VertexTextureIndexMake (GLuint inVertex, GLuint inTextureCoords, GLuint inActualVertex)
{
VertexTextureIndex *ret = malloc(sizeof(VertexTextureIndex));
ret->originalVertex = inVertex;
ret->textureCoords = inTextureCoords;
ret->actualVertex = inActualVertex;
ret->greater = NULL;
ret->lesser = NULL;
return ret;
}