Jump to content
  • Advertisement
Sign in to follow this  
Cerasti

Visual Studio 2005 and OpenGL

This topic is 4541 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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;
}

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!