Compling Opengl without the dos window

I tried to do this in Visual C++ 2008 Express and I got a wierd message. Here is what I did. I took the following code <will post at the end> and I opened a blank windows win32 app. I then fixed all my errors but I got an unusual error talking about MSVCRTD.lib. Any ideas on how to fix this?

void RenderScene(void)
{
	glClear(GL_COLOR_BUFFER_BIT);
	glFlush();
}

void SetupRC(void)
{
	glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
	glColor3f(1.0f, 0.0f, 0.0f);
	glutSwapBuffers();
}

int main(int argc, char* argv[])
{
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
	glutInitWindowSize(640,480);
	glutCreateWindow("Demo");
	glutDisplayFunc(RenderScene);
	SetupRC();

	glutMainLoop();

return 0;
}

Header file:

// Windows
#ifdef WIN32
#include <windows.h>
#include <iostream>
#include <math.h>
#include <glee.h>
#include <gl/gl.h>

#include <gl/glu.h>
#include <glut.h>
#endif

// Mac Os X
#ifdef _APPLE_
#include <Carbon/Carbon.h>
#include <iostream>
#include <math.h>
#include "glee.h"
#include <OpenGL/gl.h>

#include <OpenGL/glu.h>
#include <Glut/glut.h>
#endif 

using namespace std;

Here is a copy of the error message

1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup

Open Project Properties. Go to Linker->Advanced and write “mainCRTStartup” for “Entry Point” setting.

or replace your main with:


int _tmain(int argc, _TCHAR* argv[])

Will give this a try. Curious, what exactly does this do? I just would like to understand the code.

Or just go to the Projects Property Page -> Linker -> System and set the SubSystem value to ‘Console (/SUBSYSTEM:CONSOLE)’.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.