PDA

View Full Version : VISUAL STUDIO .net compile problem.



11-03-2002, 05:44 PM
I can't use "GLUT.h" header file with visual studio .net~!!

Please help~!! This is very frustratin'~!!

I don't know how to link them~!! The GUI is so different from VC++ 6.0. I tried the #progma to link the library, and others , but It does not work... -_-;;

I even tried, "You can also right-click the project name in solution explorer, then go to Properties...

Click the Linker folder on the left hand side, and go to the Input tab in that folder.

You can add your libraries to link with under "Additional Dependencies""

and
#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);
glLoadIdentity();
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~!!!!!

Allan Walton
11-04-2002, 12:57 AM
easy peasy lemon squeezy....

win32 programs dont use main they use winmain - change the main function to winmain and all will be well...

Allan

DaMangz
11-04-2002, 02:50 AM
Don't know squarnopoulous about VS7 but in VC6 you are compiling a console program as though it were a windows app (missing WInMain).

Figure out how to make your project a console project and this problem will disappear.

(BTW it's not glut that's working fine you are missing WinMain...)

roffe
11-04-2002, 11:47 PM
Check out the linker option SUBSYSTEM.

berserk77
11-08-2002, 11:18 AM
create a "new project" -> "visual c++ projects" -> "c/c++ console" -> name the project "project 1" add the code you posted to the .cpp file in your project, put all in in the file.. and then just add the #include <windows.h> header... F5 to run.. and bamm you get the output...