HELP ME PLEASE!!
Okay, I''m supposed to be writing a Pacman game for my VC++ class in school...I chose OpenGL cause I couldn''t find anything else to use for gfx in VC++...
I go to: File Menu -> New -> Files Tab -> C++ Source File -> OK button...I have the following code implemented so far:
#include
#include
#include
#include
GLvoid ResizeGLScene(GLsizei width, GLsizei height)
{
if(height == 0)
height = 1;
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0f, (GLfloat)width / (GLfloat)height, 0.1f, 100.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
int InitGL(GLvoid)
{
glShadeModel(GL_SMOOTH);
glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
return(TRUE);
}
int main()
{
HDC hDC = NULL;
HGLRC hRC = NULL;
HWND hWnd = NULL;
HINSTANCE hInstance = NULL;
bool Keys[256];
bool active = true;
bool fullscreen = true;
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
ResizeGLScene(640, 480);
InitGL();
return(0);
}
When I try to run it, I get the following errors:
--------------------Configuration: Pacman - Win32 Debug--------------------
Compiling...
Pacman.cpp
Linking...
Pacman.obj : error LNK2001: unresolved external symbol _gluPerspective@32
Pacman.obj : error LNK2001: unresolved external symbol __imp__glLoadIdentity@0
Pacman.obj : error LNK2001: unresolved external symbol __imp__glMatrixMode@4
Pacman.obj : error LNK2001: unresolved external symbol __imp__glViewport@16
Pacman.obj : error LNK2001: unresolved external symbol __imp__glHint@8
Pacman.obj : error LNK2001: unresolved external symbol __imp__glDepthFunc@4
Pacman.obj : error LNK2001: unresolved external symbol __imp__glEnable@4
Pacman.obj : error LNK2001: unresolved external symbol __imp__glClearDepth@8
Pacman.obj : error LNK2001: unresolved external symbol __imp__glClearColor@16
Pacman.obj : error LNK2001: unresolved external symbol __imp__glShadeModel@4
Debug/Pacman.exe : fatal error LNK1120: 10 unresolved externals
Error executing link.exe.
Pacman.exe - 11 error(s), 0 warning(s)
Can someone PLEASE help me? This is due in about a week!!!!
Thanks in advance!
Mattman
You are forgetting to link with the OpenGL/GLU libraries. Go to Project->Settings, click on the "Link" tab and in the box where it says "Object/library modules" add "opengl32.lib" and "glu32.lib" and that should fix your problem.
-Liquid
-Liquid
this may be a stupid question! but did u save the source file as a .cpp or .c make sure its a .cpp and use the settings tab to link to
opengl32.lib glu32.lib glaux.lib
opengl32.lib glu32.lib glaux.lib
Oooh, I didn''t know I had to do that! Thank you for the quick replies! I will try that now (despite the fact that I''m at school, not home). And as for the second reply, yes, it is a .cpp! Thanks again!
Mattman
mattman@nobispro.com
www.nobispro.com
Mattman
mattman@nobispro.com
www.nobispro.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement