Whats This?

Started by
4 comments, last by CoMpFreaK 20 years, 9 months ago
What does this mean? opengl2 error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup here is the code: /* This file was produced by 3D Exploration Plugin: CPP Export filter. 3D Exploration Copyright (c) 1999-2000 X Dimension Software WWW http://www.xdsoft.com/explorer/ eMail info@xdsoft.com */ #include <windows.h> #include <gl.h> #include <glu.h> struct sample_MATERIAL{ GLfloat ambient[3]; GLfloat diffuse[3]; GLfloat specular[3]; GLfloat emission[3]; GLfloat alpha; GLfloat phExp; int texture; }; static sample_MATERIAL materials [1] = { {{0.117647f,0.117647f,0.117647f}, {0.752941f,0.752941f,0.752941f}, {0.752941f,0.752941f,0.752941f}, {0.0f,0.0f,0.0f}, 1.0f,8.0f,-1} //Explorer Default }; // 8 Verticies // 8 Texture Coordinates // 8 Normals // 12 Triangles static BYTE face_indicies[12][9] = { // Box01 {2,3,0 ,0,1,2 ,0,1,2 }, {1,0,3 ,3,2,1 ,3,2,1 }, {5,7,4 ,4,5,6 ,4,5,6 }, {6,4,7 ,7,6,5 ,7,6,5 }, {1,5,0 ,3,4,2 ,3,4,2 }, {4,0,5 ,6,2,4 ,6,2,4 }, {3,7,1 ,1,5,3 ,1,5,3 }, {5,1,7 ,4,3,5 ,4,3,5 }, {2,6,3 ,0,7,1 ,0,7,1 }, {7,3,6 ,5,1,7 ,5,1,7 }, {0,4,2 ,2,6,0 ,2,6,0 }, {6,2,4 ,7,0,6 ,7,0,6 } }; static GLfloat vertices [8][3] = { {-0.175528f,-0.5f,-0.263674f},{0.175528f,-0.5f,-0.263674f},{-0.175528f,0.5f,-0.263674f}, {0.175528f,0.5f,-0.263674f},{-0.175528f,-0.5f,0.263674f},{0.175528f,-0.5f,0.263674f}, {-0.175528f,0.5f,0.263674f},{0.175528f,0.5f,0.263674f} }; static GLfloat normals [8][3] = { {-0.816497f,0.408248f,-0.408248f},{0.333333f,0.666667f,-0.666667f},{-0.333333f,-0.666667f,-0.666667f}, {0.816497f,-0.408248f,-0.408248f},{0.408248f,-0.816497f,0.408248f},{0.666667f,0.333333f,0.666667f}, {-0.666667f,-0.333333f,0.666667f},{-0.408248f,0.816497f,0.408248f} }; static GLfloat textures [8][2] = { {0.303775f,0.5f},{0.196225f,0.5f},{0.696225f,0.5f}, {0.803775f,0.5f},{0.803775f,0.102329f},{0.196225f,0.102329f}, {0.696225f,0.102329f},{0.303775f,0.102329f} }; /*Material indicies*/ /*{material index,face count}*/ static int material_ref [1][2] = { {0,12} }; void MyMaterial(GLenum mode,GLfloat *f,GLfloat alpha) { GLfloat d[4]; d[0]=f[0]; d[1]=f[1]; d[2]=f[2]; d[3]=alpha; glMaterialfv (GL_FRONT_AND_BACK,mode,d); } /* * SelectMaterial uses OpenGL commands to define facet colors. * * Returns: * Nothing */ void SelectMaterial(int i) { // // Define the reflective properties of the 3D Object faces. // glEnd(); GLfloat alpha=materials.alpha; MyMaterial (GL_AMBIENT, materials.ambient,alpha); MyMaterial (GL_DIFFUSE, materials.diffuse,alpha); MyMaterial (GL_SPECULAR, materials.specular,alpha); MyMaterial (GL_EMISSION, materials.emission,alpha); glMaterialf (GL_FRONT_AND_BACK,GL_SHININESS,materials.phExp); glBegin(GL_TRIANGLES); }; GLint Gen3DObjectList() { int i; int j; GLint lid=glGenLists(1); int mcount=0; int mindex=0; glNewList(lid, GL_COMPILE); glBegin (GL_TRIANGLES); for(i=0;i<sizeof(face_indicies)/sizeof(face_indicies[0]);i++) { if(!mcount) { SelectMaterial(material_ref[mindex][0]); mcount=material_ref[mindex][1]; mindex++; } mcount–; for(j=0;j<3;j++) { int vi=face_indicies[j]; int ni=face_indicies[j+3];//Normal index int ti=face_indicies[j+6];//Texture index glNormal3f (normals[ni][0],normals[ni][1],normals[ni][2]); glTexCoord2f(textures[ti][0],textures[ti][1]); glVertex3f (vertices[vi][0],vertices[vi][1],vertices[vi][2]); } } glEnd (); glEndList(); return lid; }; </i>
Advertisement
It means there''s no main function defined which you need for your program to compile and run properly.
quote:Original post by CoMpFreaK
What does this mean?

opengl2 error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup


Are you using Visual C++? What project type?

If you select an empty project for Win32 Application Project Type and do not define a WinMain, you will get this error.

Where''s your main/WinMain function?
Are you trying to make an executable, or a dll?
its a win 32 apllication,
i can put a:


void main()
{}

at the beggining and it compiles correctly.
problem is when i run it it shows a blank screen.
Your main function needs to call the initializations, and then runs a loop that draws everything.

This topic is closed to new replies.

Advertisement