Urgent help: fatal error

I am getting ‘unexpected end of file while looking for precompile header directive’ C1010 error.

I get this when i compile my simple VC++.net program… using GLUT I am creating a sub window that would display a sphere.

I also included stdafx.h but then it gives me more errors like C4067 & LNK2019…

any help on this will be highly appreciated… i even browsed forums, tried all recommendations but nothing helped.

thanks in advance for any help.

—Here’s my code----

#include <stdafx.h>;
#include <windows.h>;
#include <gl\glut.h>;
#include <stdlib.h>;

GLuint main_window, screen;

void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
glutSolidSphere(10, 20, 20);
glFlush();
}
void init(void)
{
glClearColor(0.0,0.0,0.0,0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0,1.0,0.0,1.0,-1.0,1.0);
}

int _WinMain(int argc, char** argv)
{

glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(640,480);
glutInitWindowPosition(100,100);
main_window = glutCreateWindow(“Welcome to blah blah”);
init();
glutCreateSubWindow(main_window,100,25,515, 430);
glutDisplayFunc(display);

glutMainLoop();
return 0;

}

I had a quick look at your code. May be you could try the following:

  • change the _WinMain to main

  • Get rid of the window.h and stdafx.h includes. (Actually you may delete stdafx.h,.cpp from your project, as you already include stdlib in your main source file.)

  • In your project settings, c++, set it to NOT use precompiled headers.

Your code should be now building (and in fact in every platform that supports glut).

You may also want to check the documentation on creating a subwindow in glut, because I don’t think you’ll see anything the way you’re trying to do things.

Hope this helps

madmortigan

[This message has been edited by madmortigan (edited 09-27-2003).]

shouldn’t it be
#include “stdafx.h” - i.e. wihtout the <> brackets?
And you normally don’t put a ; after include statements…