trying to get opengl started on vc++

Started by
13 comments, last by n_nuos 17 years, 6 months ago
i have read the faq on this site and now i DO have the files gl.h glut.h glu.h in the vc++ include dir, Opengl32.lib glut32.lib glu32.lib in lib, and Opengl32.dll glut32.dll glu32.dll in windows/system but I still get linker errors.. this is really frustrating. I am using visual c++ 2005 express edition and trying to build nehe's first lesson (I have downloaded the visual studio version from nehe.gamedev.net ) and I am getting the following error message: Linking... Lesson1.obj : error LNK2019: unresolved external symbol __imp__UnregisterClassA@8 referenced in function "void __cdecl KillGLWindow(void)" (?KillGLWindow@@YAXXZ) Lesson1.obj : error LNK2019: unresolved external symbol __imp__DestroyWindow@4 referenced in function "void __cdecl KillGLWindow(void)" (?KillGLWindow@@YAXXZ) Lesson1.obj : error LNK2019: unresolved external symbol __imp__ReleaseDC@8 referenced in function "void __cdecl KillGLWindow(void)" (?KillGLWindow@@YAXXZ) Lesson1.obj : error LNK2019: unresolved external symbol __imp__MessageBoxA@16 referenced in function "void __cdecl KillGLWindow(void)" (?KillGLWindow@@YAXXZ) Lesson1.obj : error LNK2019: unresolved external symbol __imp__ShowCursor@4 referenced in function "void __cdecl KillGLWindow(void)" (?KillGLWindow@@YAXXZ) Lesson1.obj : error LNK2019: unresolved external symbol __imp__ChangeDisplaySettingsA@8 referenced in function "void __cdecl KillGLWindow(void)" (?KillGLWindow@@YAXXZ) Lesson1.obj : error LNK2019: unresolved external symbol __imp__SetFocus@4 referenced in function "int __cdecl CreateGLWindow(char *,int,int,int,bool)" (?CreateGLWindow@@YAHPADHHH_N@Z) Lesson1.obj : error LNK2019: unresolved external symbol __imp__SetForegroundWindow@4 referenced in function "int __cdecl CreateGLWindow(char *,int,int,int,bool)" (?CreateGLWindow@@YAHPADHHH_N@Z) Lesson1.obj : error LNK2019: unresolved external symbol __imp__ShowWindow@8 referenced in function "int __cdecl CreateGLWindow(char *,int,int,int,bool)" (?CreateGLWindow@@YAHPADHHH_N@Z) Lesson1.obj : error LNK2019: unresolved external symbol __imp__SetPixelFormat@12 referenced in function "int __cdecl CreateGLWindow(char *,int,int,int,bool)" (?CreateGLWindow@@YAHPADHHH_N@Z) Lesson1.obj : error LNK2019: unresolved external symbol __imp__ChoosePixelFormat@8 referenced in function "int __cdecl CreateGLWindow(char *,int,int,int,bool)" (?CreateGLWindow@@YAHPADHHH_N@Z) Lesson1.obj : error LNK2019: unresolved external symbol __imp__GetDC@4 referenced in function "int __cdecl CreateGLWindow(char *,int,int,int,bool)" (?CreateGLWindow@@YAHPADHHH_N@Z) Lesson1.obj : error LNK2019: unresolved external symbol __imp__CreateWindowExA@48 referenced in function "int __cdecl CreateGLWindow(char *,int,int,int,bool)" (?CreateGLWindow@@YAHPADHHH_N@Z) Lesson1.obj : error LNK2019: unresolved external symbol __imp__AdjustWindowRectEx@16 referenced in function "int __cdecl CreateGLWindow(char *,int,int,int,bool)" (?CreateGLWindow@@YAHPADHHH_N@Z) Lesson1.obj : error LNK2019: unresolved external symbol __imp__RegisterClassA@4 referenced in function "int __cdecl CreateGLWindow(char *,int,int,int,bool)" (?CreateGLWindow@@YAHPADHHH_N@Z) Lesson1.obj : error LNK2019: unresolved external symbol __imp__LoadCursorA@8 referenced in function "int __cdecl CreateGLWindow(char *,int,int,int,bool)" (?CreateGLWindow@@YAHPADHHH_N@Z) Lesson1.obj : error LNK2019: unresolved external symbol __imp__LoadIconA@8 referenced in function "int __cdecl CreateGLWindow(char *,int,int,int,bool)" (?CreateGLWindow@@YAHPADHHH_N@Z) Lesson1.obj : error LNK2019: unresolved external symbol __imp__DefWindowProcA@16 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z) Lesson1.obj : error LNK2019: unresolved external symbol __imp__PostQuitMessage@4 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z) Lesson1.obj : error LNK2019: unresolved external symbol __imp__SwapBuffers@4 referenced in function _WinMain@16 Lesson1.obj : error LNK2019: unresolved external symbol __imp__DispatchMessageA@4 referenced in function _WinMain@16 Lesson1.obj : error LNK2019: unresolved external symbol __imp__TranslateMessage@4 referenced in function _WinMain@16 Lesson1.obj : error LNK2019: unresolved external symbol __imp__PeekMessageA@20 referenced in function _WinMain@16 .\Debug/lesson1.exe : fatal error LNK1120: 23 unresolved externals (note that nehe says something about a project->settings and then click on the LINK tab to add some gl modules, but there is no such thing in the menu, probably the tutorial is written for an older version of vc)
Advertisement
I'm assuming there are other files missing from the lib; make sure all the standard libs are there and you didnt delete them.

Also, if you're just starting, I'd avoid learning OpenGL now.
OH, he is referring to the VC 6.0

One sec, let me open my IDE.. Ok, I dont have the one you're using, but look for a directories, a Library, an options, a build set up, look for anything to add the .libs to the appropriate line.
why should I avoid opengl now? I am aware of the differences btw directx and gl, I have spent a few time reading to find out what I want to learn. I have chosen gl because it is portable and .. because some people say it is easyer to learn..
Quote:Original post by Crazyfool
Also, if you're just starting, I'd avoid learning OpenGL now.


Uh. What?

From the looks of it, he is just starting C++.. I'd learn more of the basics first. Granted, NeHe does an incredible job, I'd imagine it a lot more difficult putting it all to use without a foundation of programming.
If you are using VC6 then the place to specify the libraries
is under

Project | Settings | Link(tab) | General (Category pulldown)
--------------------------------------------[size="1"]Ratings are Opinion, not Fact
You're missing the default windows libraries. Add user32.lib, gdi32.lib and kernel32.lib.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

I think it's still the same for IDE setting for VS 2005 & VS 2003.
Also remember that you need to download the platform sdk for Windows if you downloaded MSVC 2005 Express. Windows® Server 2003 R2 Platform SDK. If you have already installed a PSDK then you need to update your IDE and tell it where those libraries / header files are located as described in the above posts. Just to reiterate...in MSVC 2005 you would go to Tools->Options->Projects and Solutions->VC++ Directories. The important ones are Libray Files / Include Files / Executable Files/ Source Files (see the combo box at the upper right of the dialog ). Library files will be found in "lib" directories / include files will be in "include" dirs / exectuables will be in "bin" dirs ...source will be in "src" directories.

[edit]
Updated link to newest PSDK
moe.ron

This topic is closed to new replies.

Advertisement