Hi, I'm working on learning OpenGL using Visual Studio 2005 and I ran into these errors:

1>circle.obj : error LNK2019: unresolved external symbol __imp__wglDeleteContext@4 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
1>circle.obj : error LNK2019: unresolved external symbol __imp__wglMakeCurrent@8 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
1>circle.obj : error LNK2019: unresolved external symbol __imp__wglCreateContext@4 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)

(sorry for the mess)

In any case, I keep looking it up and what people seem to be saying is that it's a library issue, and that i need to add the lib directory to additional library directories and the library itself to additional dependencies. I think i did that correctly:

/LIBPATH:"C:\glew\lib"...
glew32.lib  kernel32.lib... etc

Thats from the command line section under linker, in the project properties. That IS where the libraries are located and glew32.lib IS the name of the library >.<

What am I missing?

Answer: I did a quick file search for Opengl32.lib, and found one right in my visual studio's lib folder. I added that, and it looks like I'm golden... (oops)

>>What am I missing?

You are missing WinProc() function as explained in the error message.

It mentions WndProc() in the error. but I had that...
I figured it out though, just had to link OpenGL32.lib

LONG WINAPI WndProc(HWND hwnd, UINT Message, WPARAM wparam, LPARAM lparam){
	static HGLRC hRC;	//rendering context
	static HDC hDC;		//device context

    switch (Message){
		case WM_CREATE:
			hDC = GetDC(hwnd);	//get the device context for window
			hRC = wglCreateContext(hDC);	//create rendering context
			wglMakeCurrent(hDC,hRC);	//make rendering context current
			break;
		case WM_DESTROY:
			wglMakeCurrent(hDC,NULL);	//deselect rendering context
			wglDeleteContext(hRC);		//delete rendering context
			PostQuitMessage(0);
			break;
		default:
			return DefWindowProc(hwnd, Message, wparam, lparam);
    }
    return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.