#### Archived

This topic is now archived and is closed to further replies.

# I can't use "GLUT.h" header file with visual studio .net~!!

## Recommended Posts

##### Share on other sites
The GUI isn''t all that different. The only thing that confounded me was their move of Project->Settings to the Options dialog.

Anyway, have you tried #include for "linking" header files? That is the normal way in VC6, neh?

##### Share on other sites
ok...

I just did, ..
#include <gl/glut.h>

and in order to use the glut.h header file, I have to put the glut.dll and glut.lib files on the window''s system and system32
folders.... which I did~!!! and I get this error

The actual code is :

#include <gl/glut.h>
#include <stdlib.h>

void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glColor3f(1.0, 1.0, 1.0);

glBegin(GL_POLYGON);
glVertex3f(0.25, 0.25, 0.0);
glVertex3f(0.75, 0.25, 0.0);
glVertex3f(0.75, 0.75, 0.0);
glVertex3f(0.25, 0.75, 0.0);
glEnd();

glFlush();
}

void init(void)
{
glClearColor(0.0,0.0,0.0,0.0);
glMatrixMode(GL_PROJECTION);
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
}

int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(250,250);
glutInitWindowPosition(100,100);
glutCreateWindow("hello");
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}

and error :
"tutorial1 error LNK2019: unresolved external symbol _WinMain@16 referenced in function _WinMainCRTStartup"

HELP~!!!!!

choesh

##### Share on other sites
and this is in VISUAL STUDIO .NET

choesh

##### Share on other sites
two things:

1. Is your project a console application or win32 application? Sounds to me like you made it a windows application, and this would be wrong, with glut you make a console application.

2. shouldn''t your .lib file go into visual studio/vc98/lib folder?

##### Share on other sites
Well, I think choesh is right. When staring Win32 project, the compiler looks for WinMain(..), not main().

##### Share on other sites
umm...no..with glut you don''t have winmain...you''re main function should look like this:

  int main(int argc, char **argv){     glutInit(&argc, argv);     glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB);     glutCreateWindow("Window");     glutFullScreen();     Init();     glutMainLoop();}

with glut it looks for main, that''s why you have a console application and not a win32 app. At least with old visual c++. I use glut all the time

##### Share on other sites
Make sure you got a (win32-)CONSOLE application and not a window application.
In the settings of your project there should be something defined like _CONSOLE

3D as never seen before.. that is... it is still not to be seen ;-)

##### Share on other sites
Thank you all for responding my question.~!!!! I will try to use the console and see if it fixes..

again, thank you very much~!! This will save a lot of time~!!

choesh,

choesh

##### Share on other sites
Doesn''t glut.h use some functions from the windows.h file? I seem to recall in either the superbible or the red book it stating that.

##### Share on other sites
EDIT: My bad. GLUT only includes declarations for WINGDIAPI and APIENTRY, and then it explicitly defines them, to avoid including windows.h. All Win32 functions are called from the DLL, so there's no need to ever include windows.h explicitly when using GLUT, AFAIK, at least in anything but the client code, if that.

[edited by - zealouselixir on November 5, 2002 11:03:13 PM]

##### Share on other sites
I got it to work~!! Thank you all ~!!!!!

choesh

• ### Forum Statistics

• Total Topics
628383
• Total Posts
2982370

• 10
• 9
• 15
• 24
• 11