Visual Studio 2005 and OpenGL

Started by
13 comments, last by blanky 17 years, 11 months ago
Hello! When I used Dev-C++ it worked fine, but I never get anything to work in VS 2005 Express. I want to use OpenGL in VS 2005, but I am having problems with setting it up. I have followed a few tutorials but I can't get it to compile, the error I get is a linking error: "fatal error LNK 1120: 1 unresolved external." Just to explain how I did: I went to the project properties page, clicked 'Linker', then I clicked on the 'Input' label and typed in 'opengl32.lib glu32.lib' in the first row. I have made sure that the required DLLs are in the system directory, so that's not the problem. If anyone could help me out here I would be grateful! - Cerasti [Edited by - Heptagonal on November 9, 2007 9:42:46 AM]
Advertisement
What exactly are those link error messages?
You probably need to read this.
I already have the platform SDK, but do you have to configure it with VS 2005?

(edit) When I installed it I followed those instructions.

The error:
MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
fatal error LNK1120: 1 unresolved externals
that's an error that one typically gets when trying to build a windows application using the console application template. Did you start a Win32 Project or a Win32 Console Application?
Yes, but I unchecked 'Console application' and checked 'Windows application'.
OK, I replicated your linker error. All I had to do was comment out my WinMain function. Let's see how you declare your WinMain function... post it up. Did you perhaps forget to define it or include that source file that contains it into your project?
Here it is:
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){	static HGLRC hRC;	static HDC hDC;	switch(message)	{		case WM_CREATE:			hDC = GetDC(hWnd);			hRC = wglCreateContext(hDC);			wglMakeCurrent(hDC,hRC);			break;		case WM_DESTROY:			wglMakeCurrent(hDC,NULL);			wglDeleteContext(hRC);			PostQuitMessage(0);			break;	}	return 0;}
You might try including <windows.h> before any openGL header files, rather than afterwards. It's a longshot, but I had a similar problem before that was caused by that.
Windows.h is already included in a file called stdafx.h which VS created for me, I don't know why it got there but I suppose it's important.

This topic is closed to new replies.

Advertisement