MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup

#include <Windows.h>
#include <gl/glut.h>
#include <gl/gl.h>
#include <gl/glaux.h>

//#pragma comment(lib,"opengl32.lib") //链接API相关连的opengl32.lib这个静态库
//#pragma comment(lib,"glaux.lib")

#include <math.h>
const GLdouble Pi=3.1415926;

void myDisplay(void)
{
int i;
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLE_FAN);
glColor3f(1.0f,1.0f,1.0f);
glVertex2f(0.0f,0.0f);
for(i=0;i<8;++i)
{
glColor3f(i&0x04,i&0x02,i&0x01);
glVertex2f(cos(i*Pi/4),sin(i*Pi/4));
}
glEnd();
glFlush();
}


The results were:

1>------ Build started: Project: 032008, Configuration: Debug Win32 ------
1>Build started 2013/3/20 星期三 hubin下午 08:36:44.
1>InitializeBuildStatus:
1> Touching "Debug\032008.unsuccessfulbuild".
1>ClCompile:
1> 1.cpp
1>ManifestResourceCompile:
1> All outputs are up-to-date.
1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
1>F:\学习\vc\OpenGL\032008\Debug\032008.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:07.67
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I want some help,please!Thanks!
Where is your program supposed to be starting? Your program has no entrypoint, it does not know where you want it to begin from, or what to do.
You're following a tutorial in the wrong way.
#define glutInit_ATEXIT_HACK
#define glutCreateWindow_ATEXIT_HACK

#include <Windows.h>
#include <gl/glut.h>
#include <gl/gl.h>
#include <gl/glaux.h>

//#pragma comment(lib,"opengl32.lib") //链接API相关连的opengl32.lib这个静态库
//#pragma comment(lib,"glaux.lib")

#include <math.h>
const GLdouble Pi=3.1415926;

void myDisplay(void)
{
int i;
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLE_FAN);
glColor3f(1.0f,1.0f,1.0f);
glVertex2f(0.0f,0.0f);
for(i=0;i<8;++i)
{
glColor3f(i&0x04,i&0x02,i&0x01);
glVertex2f(cos(i*Pi/4),sin(i*Pi/4));
}
glEnd();
glFlush();
}
int main(int argc,char*argv[])
{
glutInit(&argc,argv);//对glut进行初始化 这个函数必须在其他的Glut使用前调用一次 格式死板
glutInitDisplayMode(GLUT_RGB|GLUT_SINGLE);//设置显示方式;rgb使用RGB颜色;使用单缓冲
glutInitWindowPosition(683,384);//设置窗口在屏幕中的位置
glutInitWindowSize(200,200);//窗口大小
glutCreateWindow("one");//根据前面信息创建一个窗口需要调用glutmainloop才看到窗口
glutDisplayFunc(&myDisplay);//需要画图时请调用mydisplay函数
glutMainLoop();//能够显示窗口
return 0;
}




!!!!!!


"Unhandled exception at 0x1000bbae in 032008.exe: 0xC0000005: Access violation writing location 0x000000a8."


can you help me?






At which point in the program does it crash?
Do you have any warnings while compiling?
Topic archived. No new replies allowed.