Skip to main content
gamedev.net
🔒 Locked

errors in GLUT code

Started by bsdpowa Jun 3, 2004 at 12:51 PM 3 replies 850+ views
Original Post
bsdpowa
bsdpowa
hi, im trying to do some ogl stuff, im reading the Redbook, chapter 1 and i got to this glut example, i did exactly as it''s said in the book but i get errors.can anyone help me? #include <windows.h> #include <gl/gl.h> #include <gl/glut.h> void display(void) { glClear(GL_COLOR_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(230, 230); glutInitWindowPosition(100, 100); glutCreateWindow("test2"); init(); glutDisplayFunc(display); glutMainLoop(); return 0; } --------------------Configuration: test2 - Win32 Debug-------------------- Compiling... test2.cpp Linking... LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16 Debug/test2.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. test2.exe - 2 error(s), 0 warning(s)
_the_phantom_
_the_phantom_
set as a console application and not as a win32 application in the settings
Sneftel
Sneftel
Your problem is unrelated to OpenGL or GLUT. You simply need to set up your program with the "Console application" subsystem. It should be somewhere in the project options.


"Sneftel is correct, if rather vulgar." --Flarelocke
rafalp
rafalp
replace this

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

with

#include <gl/glut.h>
.
.

and set up your program as a Console application instead of GUI app.

Sincerely,
Rafal Pielech
bsdpowa
bsdpowa
thank you all very much! it works now

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.