我遇到两个错误,无法弄清楚如何解决,这里是:
错误LNK2028:未解析的标记(0A0003A0)“void __cdecl polygon(int,int,int,int,unsigned int)”(?polygon @@ $$ FYAXHHHHI @ Z)在函数“void __cdecl vox_texture_cube(unsigned int, unsigned int)“(?vox_texture_cube @@ $$ FYAXII @ Z)
错误LNK2019:未解析的外部符号“void __cdecl polygon(int,int,int,int,unsigned int)”(?polygon @@ $$ FYAXHHHHI @ Z)在函数“void __cdecl vox_texture_cube”中引用(unsigned int,unsigned int )“(?vox_texture_cube @@ $$ FYAXII @ Z)
我唯一尝试的是进入Project属性中的General Options,并根据此处的另一个问题将公共语言运行时支持更改为/ clr pure,但这会导致更多问题。
这是我的代码:
//This Function creates a Polygon Face using Vertice Array
//It is the Method for creating each face of a cube
void **polgon**(int a, int b, int c, int d, GLuint texture)
{
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, whiteSpecularMaterial);
glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, mShininess);
glBindTexture(GL_TEXTURE_2D, texture);
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0);
glVertex3fv(vertices[a]);
glTexCoord2f(1.0, 0.0);
glVertex3fv(vertices[b]);
glTexCoord2f(1.0, 1.0);
glVertex3fv(vertices[c]);
glTexCoord2f(0.0, 1.0);
glVertex3fv(vertices[d]);
glEnd();
}
答案 0 :(得分:0)
嗯,你宣布一个名为
的函数 void polygon(int a, int b, int c, int d, GLuint texture);
然后实现一个名为
的函数void polgon(int a, int b, int c, int d, GLuint texture)
{
...
}
所以问题是链接器试图找到你承诺你会实现但没有实现的函数polygon
。
解决方案:将polgon
重命名为polygon
,您应该很高兴。