Pregunta

I'm getting two errors and cannot figure out how to resolve, here they are:

error LNK2028: unresolved token (0A0003A0) "void __cdecl polygon(int,int,int,int,unsigned int)" (?polygon@@$$FYAXHHHHI@Z) referenced in function "void __cdecl vox_texture_cube(unsigned int,unsigned int)" (?vox_texture_cube@@$$FYAXII@Z)

error LNK2019: unresolved external symbol "void __cdecl polygon(int,int,int,int,unsigned int)" (?polygon@@$$FYAXHHHHI@Z) referenced in function "void __cdecl vox_texture_cube(unsigned int,unsigned int)" (?vox_texture_cube@@$$FYAXII@Z)

The only thing I have tried is going into the General Options in the Project properties and changing the Common Language RunTime Support to /clr pure as per another question on here, however, that causes more problems.

Here is my code:

//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();
}
¿Fue útil?

Solución

Well, you declare a function called

void polygon(int a, int b, int c, int d, GLuint texture);

And then you implement a function called

void polgon(int a, int b, int c, int d, GLuint texture)
{
    ...
}

So the problem is that the linker is trying to find the function polygon which you promised you would implement but didn't.

Solution: Rename polgon to polygon and you should be good to go.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top